def main(): _, args = parse_args(sys.argv[1:]) args = args.__dict__ config = Config(**args) init_api_context() config.output_folder = os.path.abspath(config.output_folder) if not os.path.exists(config.output_folder): mkdir_p(config.output_folder) print(f"Updating build index: {(config.output_folder)}\n") update_index(config.output_folder, verbose=config.debug, threads=1) recipe = args["recipe"][0] if args["test"]: api.test(recipe, config=config) else: api.build( recipe, post=args["post"], build_only=args["build_only"], notest=args["notest"], config=config, variants=args["variants"], )
def build_conda_pack(base_path, tmp, hexrd_package_channel, hexrdgui_output_folder): # First build the hexrdgui package recipe_path = str(base_path / '..' / 'conda.recipe') config = Config() config.channel = ['cjh1', 'anaconda', 'conda-forge'] config.channel_urls = ['cjh1', 'anaconda', 'conda-forge'] if hexrdgui_output_folder is not None: config.output_folder = hexrdgui_output_folder if hexrd_package_channel is not None: config.channel.insert(0, 'hexrd-channel') config.channel_urls.insert(0, hexrd_package_channel) config.CONDA_PY = '38' logger.info('Building hexrdgui conda package.') CondaBuild.build(recipe_path, config=config) logger.info('Creating new conda environment.') # Now create a new environment to install the package into env_prefix = str(tmp / package_env_name) channels = ['--channel', 'anaconda', '--channel', 'conda-forge'] # For the mac we need to use our own version of Python built with the # latest SDK. See https://github.com/HEXRD/hexrdgui/issues/505 for # more details. So we add the HEXRD channel that has our Python package. if platform.system() == 'Darwin': channels = ['--channel', 'HEXRD'] + channels Conda.run_command(Conda.Commands.CREATE, '--prefix', env_prefix, *channels, 'python=3.8.4') hexrdgui_output_folder_uri = Path( hexrdgui_output_folder).absolute().as_uri() logger.info('Installing hexrdgui into new environment.') # Install hexrdgui into new environment params = [ Conda.Commands.INSTALL, '--prefix', env_prefix, '--channel', hexrdgui_output_folder_uri, '--channel', hexrd_package_channel, '--channel', 'cjh1', '--channel', 'anaconda', '--channel', 'conda-forge', 'hexrdgui' ] Conda.run_command(*params) logger.info('Generating tar from environment using conda-pack.') # Now use conda-pack to create relocatable archive archive_path = str(tmp / ('hexrdgui.%s' % archive_format)) CondaPack.pack(prefix=env_prefix, output=archive_path, format=archive_format) return archive_path
def build_conda_pack(base_path, tmp, hexrd_package_channel, hexrdgui_output_folder): # First build the hexrdgui package recipe_path = str(base_path / '..' / 'conda.recipe') config = Config() config.channel = ['cjh1', 'anaconda', 'conda-forge'] config.channel_urls = ['cjh1', 'anaconda', 'conda-forge'] if hexrdgui_output_folder is not None: config.output_folder = hexrdgui_output_folder if hexrd_package_channel is not None: config.channel.insert(0, 'hexrd-channel') config.channel_urls.insert(0, hexrd_package_channel) config.CONDA_PY = '38' logger.info('Building hexrdgui conda package.') CondaBuild.build(recipe_path, config=config) logger.info('Creating new conda environment.') # Now create a new environment to install the package into env_prefix = str(tmp / package_env_name) Conda.run_command(Conda.Commands.CREATE, '--prefix', env_prefix, 'python=3.8') hexrdgui_output_folder_uri = Path( hexrdgui_output_folder).absolute().as_uri() logger.info('Installing hexrdgui into new environment.') # Install hexrdgui into new environment params = [ Conda.Commands.INSTALL, '--prefix', env_prefix, '--channel', hexrdgui_output_folder_uri, '--channel', hexrd_package_channel, '--channel', 'cjh1', '--channel', 'anaconda', '--channel', 'conda-forge', 'hexrdgui' ] Conda.run_command(*params) logger.info('Generating tar from environment using conda-pack.') # Now use conda-pack to create relocatable archive archive_path = str(tmp / ('hexrdgui.%s' % archive_format)) CondaPack.pack(prefix=env_prefix, output=archive_path, format=archive_format) return archive_path
def prepare(**kwargs): """ Prepare and configure the stage for mambabuild to run. The given **kwargs are passed to conda-build's Config which is the value returned by this function. """ config = Config(**kwargs) config.channel_urls = get_channel_urls(kwargs) init_api_context() config.output_folder = os.path.abspath(config.output_folder) if not os.path.exists(config.output_folder): mkdir_p(config.output_folder) print(f"Updating build index: {(config.output_folder)}\n") update_index(config.output_folder, verbose=config.debug, threads=1) return config
def build_conda_pack(base_path, tmp, hexrd_package_channel, hexrdgui_output_folder): # First build the hexrdgui package recipe_path = str(base_path / '..' / 'conda.recipe') config = Config() config.channel = ['cjh1', 'anaconda', 'conda-forge'] config.channel_urls = ['cjh1', 'anaconda', 'conda-forge'] if hexrdgui_output_folder is not None: config.output_folder = hexrdgui_output_folder if hexrd_package_channel is not None: config.channel.insert(0, 'hexrd-channel') config.channel_urls.insert(0, hexrd_package_channel) # Determine the latest hexrd version in the hexrd_package_channel # (release or pre-release), and force that hexrd version to be used. params = [ Conda.Commands.SEARCH, '--channel', hexrd_package_channel, '--json', 'hexrd', ] output = Conda.run_command(*params) results = json.loads(output[0]) hexrd_version = results['hexrd'][-1]['version'] config.variant['hexrd_version'] = hexrd_version config.CONDA_PY = '38' logger.info('Building hexrdgui conda package.') CondaBuild.build(recipe_path, config=config) logger.info('Creating new conda environment.') # Now create a new environment to install the package into env_prefix = str(tmp / package_env_name) channels = ['--channel', 'anaconda', '--channel', 'conda-forge'] # For the mac we need to use our own version of Python built with the # latest SDK. See https://github.com/HEXRD/hexrdgui/issues/505 for # more details. So we add the HEXRD channel that has our Python package. if platform.system() == 'Darwin': channels = ['--channel', 'HEXRD'] + channels Conda.run_command(Conda.Commands.CREATE, '--prefix', env_prefix, *channels, 'python=3.8.4') hexrdgui_output_folder_uri = Path( hexrdgui_output_folder).absolute().as_uri() logger.info('Installing hexrdgui into new environment.') # Install hexrdgui into new environment params = [ Conda.Commands.INSTALL, '--prefix', env_prefix, '--channel', hexrdgui_output_folder_uri, '--channel', hexrd_package_channel, '--channel', 'cjh1', '--channel', 'anaconda', '--channel', 'conda-forge', f'hexrd=={hexrd_version}', 'hexrdgui' ] Conda.run_command(*params) # Override the libgfortran so we get a version that is # build with a SDK that is acceptable to the notary! if platform.system() == 'Darwin': params = [ Conda.Commands.INSTALL, '--prefix', env_prefix, '--channel', 'conda-forge', 'libgfortran=4.0.0' ] Conda.run_command(*params) logger.info('Generating tar from environment using conda-pack.') # Now use conda-pack to create relocatable archive archive_path = str(tmp / ('hexrdgui.%s' % archive_format)) CondaPack.pack(prefix=env_prefix, output=archive_path, format=archive_format) return archive_path