contrib/automation/hgautomation/cli.py
branchstable
changeset 44768 9d441f820c8b
parent 43076 2372284d9457
child 44771 802ee93c205d
equal deleted inserted replaced
44767:234882d17814 44768:9d441f820c8b
    97                 instance.winrm_client, a, DIST_PATH, version=version
    97                 instance.winrm_client, a, DIST_PATH, version=version
    98             )
    98             )
    99 
    99 
   100 
   100 
   101 def build_windows_wheel(
   101 def build_windows_wheel(
   102     hga: HGAutomation, aws_region, arch, revision, base_image_name
   102     hga: HGAutomation,
       
   103     aws_region,
       
   104     python_version,
       
   105     arch,
       
   106     revision,
       
   107     base_image_name,
   103 ):
   108 ):
   104     c = hga.aws_connection(aws_region)
   109     c = hga.aws_connection(aws_region)
   105     image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
   110     image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
   106     DIST_PATH.mkdir(exist_ok=True)
   111     DIST_PATH.mkdir(exist_ok=True)
   107 
   112 
   108     with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts:
   113     with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts:
   109         instance = insts[0]
   114         instance = insts[0]
   110 
   115 
   111         windows.synchronize_hg(SOURCE_ROOT, revision, instance)
   116         windows.synchronize_hg(SOURCE_ROOT, revision, instance)
   112 
   117 
   113         for a in arch:
   118         for py_version in python_version:
   114             windows.build_wheel(instance.winrm_client, a, DIST_PATH)
   119             for a in arch:
       
   120                 windows.build_wheel(
       
   121                     instance.winrm_client, py_version, a, DIST_PATH
       
   122                 )
   115 
   123 
   116 
   124 
   117 def build_all_windows_packages(
   125 def build_all_windows_packages(
   118     hga: HGAutomation, aws_region, revision, version, base_image_name
   126     hga: HGAutomation, aws_region, revision, version, base_image_name
   119 ):
   127 ):
   126 
   134 
   127         winrm_client = instance.winrm_client
   135         winrm_client = instance.winrm_client
   128 
   136 
   129         windows.synchronize_hg(SOURCE_ROOT, revision, instance)
   137         windows.synchronize_hg(SOURCE_ROOT, revision, instance)
   130 
   138 
       
   139         for py_version in ("2.7", "3.7", "3.8"):
       
   140             for arch in ("x86", "x64"):
       
   141                 windows.purge_hg(winrm_client)
       
   142                 windows.build_wheel(
       
   143                     winrm_client,
       
   144                     python_version=py_version,
       
   145                     arch=arch,
       
   146                     dest_path=DIST_PATH,
       
   147                 )
       
   148 
   131         for arch in ('x86', 'x64'):
   149         for arch in ('x86', 'x64'):
   132             windows.purge_hg(winrm_client)
       
   133             windows.build_wheel(winrm_client, arch, DIST_PATH)
       
   134             windows.purge_hg(winrm_client)
   150             windows.purge_hg(winrm_client)
   135             windows.build_inno_installer(
   151             windows.build_inno_installer(
   136                 winrm_client, arch, DIST_PATH, version=version
   152                 winrm_client, arch, DIST_PATH, version=version
   137             )
   153             )
   138             windows.purge_hg(winrm_client)
   154             windows.purge_hg(winrm_client)
   312     )
   328     )
   313     sp.set_defaults(func=build_inno)
   329     sp.set_defaults(func=build_inno)
   314 
   330 
   315     sp = subparsers.add_parser(
   331     sp = subparsers.add_parser(
   316         'build-windows-wheel', help='Build Windows wheel(s)',
   332         'build-windows-wheel', help='Build Windows wheel(s)',
       
   333     )
       
   334     sp.add_argument(
       
   335         '--python-version',
       
   336         help='Python version to build for',
       
   337         choices={'2.7', '3.7', '3.8'},
       
   338         nargs='*',
       
   339         default=['3.8'],
   317     )
   340     )
   318     sp.add_argument(
   341     sp.add_argument(
   319         '--arch',
   342         '--arch',
   320         help='Architecture to build for',
   343         help='Architecture to build for',
   321         choices={'x86', 'x64'},
   344         choices={'x86', 'x64'},