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 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