Simone Pelosi has proposed merging ~pelpsi/lpci:conda-build-outside-env into lpci:main.
Commit message: Fixed conda-build plugin lpci conda build plugin should install and run conda-build outside of a conda environment LP: #1978717 Requested reviews: Launchpad code reviewers (launchpad-reviewers) Related bugs: Bug #1978717 in lpci: "lpcraft conda build plugin should install and run conda-build outside of a conda environment" https://bugs.launchpad.net/lpci/+bug/1978717 For more details, see: https://code.launchpad.net/~pelpsi/lpci/+git/lpcraft/+merge/442492 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/lpci:conda-build-outside-env into lpci:main.
diff --git a/NEWS.rst b/NEWS.rst index 34f9f96..d4515c2 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -2,6 +2,12 @@ Version history =============== +0.1.3 (unreleased) +================== + +- Fix conda-build plugin to install and run outside + of a conda environment. + 0.1.2 (2023-05-02) ================== diff --git a/lpci/plugin/tests/test_plugins.py b/lpci/plugin/tests/test_plugins.py index b0c5844..144286d 100644 --- a/lpci/plugin/tests/test_plugins.py +++ b/lpci/plugin/tests/test_plugins.py @@ -364,22 +364,13 @@ class TestPlugins(CommandBaseTestCase): /tmp/miniconda.sh -b fi export PATH=$HOME/miniconda3/bin:$PATH - conda remove --all -q -y -n $CONDA_ENV - conda create -n $CONDA_ENV -q -y -c conda-forge -c defaults PYTHON=3.8 mamba pip - source activate $CONDA_ENV + conda install -q -y -c conda-forge -c defaults PYTHON=3.8 mamba pip """ # noqa:E501 ) - run_command = dedent( - """ - export PATH=$HOME/miniconda3/bin:$PATH - source activate $CONDA_ENV - pip install --upgrade pytest - """ - ) + run_command = dedent("""pip install --upgrade pytest\n""") post_run_command = ( - "export PATH=$HOME/miniconda3/bin:$PATH; " - "source activate $CONDA_ENV; conda env export" + "export PATH=$HOME/miniconda3/bin:$PATH; conda env export" ) self.run_command("run") @@ -563,22 +554,18 @@ class TestPlugins(CommandBaseTestCase): /tmp/miniconda.sh -b fi export PATH=$HOME/miniconda3/bin:$PATH - conda remove --all -q -y -n $CONDA_ENV - conda create -n $CONDA_ENV -q -y -c conda-forge -c defaults -c https://user:p...@canonical.example.com/artifactory/soss-conda-stable-local/ PYTHON=3.8 conda-build mamba pip - source activate $CONDA_ENV + conda install -q -y -c conda-forge -c defaults -c https://user:p...@canonical.example.com/artifactory/soss-conda-stable-local/ PYTHON=3.8 conda-build mamba pip """ # noqa:E501 ) run_command = dedent( """ export PATH=$HOME/miniconda3/bin:$PATH - source activate $CONDA_ENV conda-build --no-anaconda-upload --output-folder dist -c conda-forge -c defaults -c https://user:p...@canonical.example.com/artifactory/soss-conda-stable-local/ info/recipe/parent pip install --upgrade pytest """ # noqa: E501 ) post_run_command = ( - "export PATH=$HOME/miniconda3/bin:$PATH; " - "source activate $CONDA_ENV; conda env export" + "export PATH=$HOME/miniconda3/bin:$PATH; conda env export" ) self.run_command( @@ -866,7 +853,6 @@ class TestPlugins(CommandBaseTestCase): run_command = dedent( """ export PATH=$HOME/miniconda3/bin:$PATH - source activate $CONDA_ENV conda-build --no-anaconda-upload --output-folder dist -c conda-forge -c defaults -m info/recipe/parent/conda_build_config.yaml -m info/recipe/conda_build_config.yaml info/recipe/parent pip install --upgrade pytest """ # noqa: E501 diff --git a/lpci/plugins/plugins.py b/lpci/plugins/plugins.py index 6fe88a2..bf1c3ed 100644 --- a/lpci/plugins/plugins.py +++ b/lpci/plugins/plugins.py @@ -206,29 +206,19 @@ class MiniCondaPlugin(BasePlugin): /tmp/miniconda.sh -b fi export PATH=$HOME/miniconda3/bin:$PATH - conda remove --all -q -y -n $CONDA_ENV - conda create -n $CONDA_ENV -q -y {conda_channels} {' '.join(self.conda_packages)} - source activate $CONDA_ENV + conda install -q -y {conda_channels} {' '.join(self.conda_packages)} {run}""" # noqa:E501 ) @hookimpl # type: ignore def lpci_execute_run(self) -> str: run = self.config.run or "" - return textwrap.dedent( - f""" - export PATH=$HOME/miniconda3/bin:$PATH - source activate $CONDA_ENV - {run}""" - ) + return textwrap.dedent(f"{run}") @hookimpl # type: ignore def lpci_execute_after_run(self) -> str: run = f"; {self.config.run_after}" if self.config.run_after else "" - return ( - "export PATH=$HOME/miniconda3/bin:$PATH; " - f"source activate $CONDA_ENV; conda env export{run}" - ) + return f"export PATH=$HOME/miniconda3/bin:$PATH; conda env export{run}" @register(name="conda-build") @@ -406,7 +396,6 @@ class CondaBuildPlugin(MiniCondaPlugin): return textwrap.dedent( f""" export PATH=$HOME/miniconda3/bin:$PATH - source activate $CONDA_ENV {build_command}{conda_channels}{configs} {self.build_target} {run_command}""" ) diff --git a/setup.cfg b/setup.cfg index 29511f1..dd0f196 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = lpci -version = 0.1.2 +version = 0.1.3.dev0 description = Runner for Launchpad CI jobs long_description = file: README.rst long_description_content_type = text/x-rst
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp