launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29911
[Merge] ~cjwatson/lpcraft:rename into lpcraft:main
Colin Watson has proposed merging ~cjwatson/lpcraft:rename into lpcraft:main.
Commit message:
Rename to lpci
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/lpcraft/+git/lpcraft/+merge/441081
Although we use several of the `craft-*` libraries, we don't use the parts lifecycle, so it's confusing to use a name ending in "craft". Rename the project to "lpci" instead; that's nice and short, and it also fits how we talk about the project more generally ("Launchpad CI").
Before landing this, we'll need to register a new snap (which is apparently the only way to "rename" a snap) and reconfigure the recipe to use that.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lpcraft:rename into lpcraft:main.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index fe1a5c5..10316e5 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -10,9 +10,9 @@ repos:
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- exclude: lpcraft/commands/tests/launchpad-wadl\.xml
+ exclude: lpci/commands/tests/launchpad-wadl\.xml
- id: trailing-whitespace
- exclude: lpcraft/commands/tests/launchpad-wadl\.xml
+ exclude: lpci/commands/tests/launchpad-wadl\.xml
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index aee0311..ee4676e 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -10,12 +10,12 @@ Prerequisites
Usage
-----
-Install the ``lpcraft`` project in editable mode inside a virtualenv environment named ``venv``.
+Install the ``lpci`` project in editable mode inside a virtualenv environment named ``venv``.
.. code:: bash
$ tox --devenv venv
- $ venv/bin/lpcraft --help # Alternatively, you can activate the virtualenv environment.
+ $ venv/bin/lpci --help # Alternatively, you can activate the virtualenv environment.
List the ``tox`` environments available for this project.
@@ -42,7 +42,7 @@ the tests, arguments can be passed to ``pytest``.
.. code:: bash
- $ tox -e py38 -- lpcraft/commands/tests/test_run.py
+ $ tox -e py38 -- lpci/commands/tests/test_run.py
$ tox -e py38 -- -k test_missing_config_file
$ tox -e py39 -- --lf
@@ -84,6 +84,6 @@ Build the documentation locally.
.. note::
In order to update the `project's documentation
- <https://lpcraft.readthedocs.io/en/latest/>`_ online,
+ <https://lpci.readthedocs.io/en/latest/>`_ online,
after having pushed your changes to the repository, you need to trigger a
manual build on the project's dashboard on https://readthedocs.org.
diff --git a/NEWS.rst b/NEWS.rst
index 37c0614..0981660 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -7,6 +7,8 @@ Version history
- Add a ``release`` command.
+- Rename project to ``lpci``.
+
0.0.52 (2023-04-06)
===================
- Fix regression from adding support to snap keys
diff --git a/README.rst b/README.rst
index ea8aa45..72d0f59 100644
--- a/README.rst
+++ b/README.rst
@@ -1,8 +1,8 @@
-=======
-lpcraft
-=======
+====
+lpci
+====
-``lpcraft`` is a runner for continuous integration jobs in Launchpad. It is
+``lpci`` is a runner for continuous integration jobs in Launchpad. It is
intended mainly for use in Launchpad builders, but can also be installed and
used locally on branches with a ``.launchpad.yaml`` file.
@@ -15,16 +15,16 @@ the CLI design is based on both those tools.
Running
=======
-``lpcraft`` is mainly intended to be consumed as a snap. Simply install with
-``sudo snap install lpcraft --classic``.
+``lpci`` is mainly intended to be consumed as a snap. Simply install with
+``sudo snap install lpci --classic``.
-You can also run ``lpcraft run`` from a directory containing ``.launchpad.yaml``.
+You can also run ``lpci run`` from a directory containing ``.launchpad.yaml``.
-To save the output from a job, use ``lpcraft run --output-directory
+To save the output from a job, use ``lpci run --output-directory
/path/to/output/directory``.
Documentation
=============
-For more extensive documentation, see `lpcraft on readthedocs
-<https://lpcraft.readthedocs.io/en/latest/>`_.
+For more extensive documentation, see `lpci on readthedocs
+<https://lpci.readthedocs.io/en/latest/>`_.
diff --git a/docs/cli-interface.rst b/docs/cli-interface.rst
index 49f3c4f..5bee54b 100644
--- a/docs/cli-interface.rst
+++ b/docs/cli-interface.rst
@@ -5,37 +5,37 @@ CLI interface
Please note that this is only a small selection of the available commands and
options.
-Please run ``lpcraft --help`` to see all commands.
+Please run ``lpci --help`` to see all commands.
-lpcraft run
------------
+lpci run
+--------
This command runs all jobs listed via pipelines from a configuration file.
**Example:**
-``lpcraft run``
+``lpci run``
-lpcraft run optional arguments
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+lpci run optional arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``--package-repository`` (provide an additional repository), e.g.
- ``lpcraft run --package-repository "deb http://archive.ubuntu.com/ubuntu/ focal main restricted"``
+ ``lpci run --package-repository "deb http://archive.ubuntu.com/ubuntu/ focal main restricted"``
This option is repeatable.
- ``--plugin-setting``, e.g.
- ``lpcraft run --plugin-setting="foo=bar"``
+ ``lpci run --plugin-setting="foo=bar"``
This option is repeatable.
- ``--replace-package-repositories SOURCE_LINE``, e.g.
- ``lpcraft run --replace-package-repositories "deb http://archive.ubuntu.com/ubuntu/ focal main restricted"``
+ ``lpci run --replace-package-repositories "deb http://archive.ubuntu.com/ubuntu/ focal main restricted"``
This option is repeatable.
- ``--secrets``, e.g.
- ``lpcraft run --secrets="<path-to-configuration-file>"``
+ ``lpci run --secrets="<path-to-configuration-file>"``
The configuration file should look like...
@@ -45,7 +45,7 @@ lpcraft run optional arguments
another_key: another_secret
- ``--set-env KEY=VALUE``, e.g.
- ``lpcraft run --set-env="PIP_INDEX_URL=http://pypi.example.com/simple"``
+ ``lpci run --set-env="PIP_INDEX_URL=http://pypi.example.com/simple"``
This option is repeatable.
@@ -54,36 +54,36 @@ lpcraft run optional arguments
This option requires an NVIDIA GPU on the host system; if passed on a
system without such a GPU, container setup will fail.
-lpcraft run-one
----------------
+lpci run-one
+------------
This command runs one specified job.
**Example:**
-``lpcraft run-one test 0``
+``lpci run-one test 0``
where ``test`` is the job name and ``0`` is the index of the job/matrix.
-lpcraft run-one optional arguments
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+lpci run-one optional arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``--package-repository`` (provide an additional repository), e.g.
- ``lpcraft run-one --package-repository "deb http://archive.ubuntu.com/ubuntu/ focal main restricted" test 0``
+ ``lpci run-one --package-repository "deb http://archive.ubuntu.com/ubuntu/ focal main restricted" test 0``
This option is repeatable.
- ``--plugin-setting``, e.g.
- ``lpcraft run-one --plugin-setting="foo=bar" test 0``
+ ``lpci run-one --plugin-setting="foo=bar" test 0``
This option is repeatable.
- ``--replace-package-repositories SOURCE_LINE``, e.g.
- ``lpcraft run-one --replace-package-repositories "deb http://archive.ubuntu.com/ubuntu/ focal main restricted" test 0``
+ ``lpci run-one --replace-package-repositories "deb http://archive.ubuntu.com/ubuntu/ focal main restricted" test 0``
This option is repeatable.
- ``--secrets``, e.g.
- ``lpcraft run-one --secrets="<path-to-configuration-file>" test 0``
+ ``lpci run-one --secrets="<path-to-configuration-file>" test 0``
The configuration file should look like...
@@ -93,12 +93,12 @@ lpcraft run-one optional arguments
another_key: another_secret
- ``--set-env KEY=VALUE``, e.g.
- ``lpcraft run-one --set-env="PIP_INDEX_URL=http://pypi.example.com/simple" test 0``
+ ``lpci run-one --set-env="PIP_INDEX_URL=http://pypi.example.com/simple" test 0``
This option is repeatable.
-lpcraft release
----------------
+lpci release
+------------
This command releases a Launchpad build of a commit to a target archive
(which must be configured with a repository format that accepts packages of
@@ -107,10 +107,10 @@ successfully built and has some attached files.
**Example:**
-``lpcraft release ppa:ubuntu-security/soss/soss-python-stable-local focal edge``
+``lpci release ppa:ubuntu-security/soss/soss-python-stable-local focal edge``
-lpcraft release optional arguments
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+lpci release optional arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ``--launchpad INSTANCE`` to use a Launchpad instance other than
production.
diff --git a/docs/conf.py b/docs/conf.py
index 678f3f9..c4df97a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -18,8 +18,8 @@ sys.path.insert(0, os.path.abspath(".."))
# -- Project information -----------------------------------------------------
-project = "lpcraft"
-copyright = "2021-2022, Canonical Ltd"
+project = "lpci"
+copyright = "2021-2023, Canonical Ltd"
# -- General configuration ---------------------------------------------------
diff --git a/docs/configuration.rst b/docs/configuration.rst
index 5875b36..65b0b5d 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -155,12 +155,12 @@ Input properties
Input makes artifacts from previous pipeline stages available. This only
works if those artifacts were saved using the ``--output-directory`` option
-to ``lpcraft run``.
+to ``lpci run``.
-``lpcraft`` copies artifact data to the ``files`` subdirectory of the
+``lpci`` copies artifact data to the ``files`` subdirectory of the
designated target directory, and writes a ``properties`` file in the
designated target directory with JSON-encoded properties of the copied
-artifacts. (This mirrors the output file structure created by ``lpcraft run
+artifacts. (This mirrors the output file structure created by ``lpci run
--output-directory``.)
``job-name``
diff --git a/docs/index.rst b/docs/index.rst
index 488b44c..c13a0ab 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,12 +1,12 @@
-.. lpcraft documentation master file, created by
+.. lpci documentation master file, created by
sphinx-quickstart on Tue Dec 7 12:44:23 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
-lpcraft
-=======
+lpci
+====
-``lpcraft`` is a runner for continuous integration jobs in Launchpad. It is
+``lpci`` is a runner for continuous integration jobs in Launchpad. It is
intended mainly for use in Launchpad builders, but can also be installed and
used locally on branches with a ``.launchpad.yaml`` file.
@@ -35,7 +35,7 @@ Example configuration
output:
paths: [output]
- $ lpcraft run --output-directory out
+ $ lpci run --output-directory out
Running the job
$ tree out # Find out the location of the output file
out
diff --git a/docs/plugins.rst b/docs/plugins.rst
index ef7234b..8ded6da 100644
--- a/docs/plugins.rst
+++ b/docs/plugins.rst
@@ -1,50 +1,50 @@
-Extending lpcraft
-=================
+Extending lpci
+==============
-lpcraft uses `pluggy <https://pluggy.readthedocs.io/>`_ to customize the
+lpci uses `pluggy <https://pluggy.readthedocs.io/>`_ to customize the
default behaviour. For example the following code snippet would extend the
packages which need to be installed into an environment by additional
requirements:
.. code-block:: python
- from lpcraft.plugin import hookimpl
+ from lpci.plugin import hookimpl
@hookimpl
- def lpcraft_install_packages():
+ def lpci_install_packages():
return ["tox"]
Plugin discovery
----------------
As currently only builtin plugins are supported,
-you need to define a plugin in ``lpcraft/plugins/<plugin>``
-and import the module in ``lpcraft/plugins/__init__.py``.
+you need to define a plugin in ``lpci/plugins/<plugin>``
+and import the module in ``lpci/plugins/__init__.py``.
Plugin implementation
---------------------
Please consult the `pluggy <https://pluggy.readthedocs.io/>`_ documentation,
-and have a look at the ``lpcraft/plugins`` directory for inspiration.
+and have a look at the ``lpci/plugins`` directory for inspiration.
Name of the hook
****************
-.. automodule:: lpcraft.plugin
+.. automodule:: lpci.plugin
:members:
:exclude-members: hookimpl
Implementation marker
*********************
-.. autodata:: lpcraft.plugin.hookimpl
+.. autodata:: lpci.plugin.hookimpl
:no-value:
Available hooks
***************
-.. automodule:: lpcraft.plugin.hookspecs
+.. automodule:: lpci.plugin.hookspecs
:members:
.. _plugin_configuration_keys:
@@ -97,7 +97,7 @@ interpolate the command, like in the following example:
INTERPOLATES_RUN_COMMAND = True
@hookimpl
- def lpcraft_execute_run(self) -> str:
+ def lpci_execute_run(self) -> str:
run = self.config.run or ""
return textwrap.dedent(
f"""\
@@ -113,7 +113,7 @@ commands.
Builtin plugins
---------------
-.. automodule:: lpcraft.plugins.plugins
+.. automodule:: lpci.plugins.plugins
:members:
Using a builtin plugin
diff --git a/docs/release-process.rst b/docs/release-process.rst
index 4c59ff6..c458ab4 100644
--- a/docs/release-process.rst
+++ b/docs/release-process.rst
@@ -14,7 +14,8 @@ How to create a new release
following the `semver <https://semver.org/>`_ recommendations
- once the MP has been merged to the ``main`` branch,
- a `Launchpad recipe <https://launchpad.net/~launchpad/lpcraft/+snap/lpcraft>`_
+ a `Launchpad recipe
+ <https://launchpad.net/~launchpad/lpci/+snap/lpci>`_
automatically builds and publishes Snap packages to the ``edge`` channel
- once the Snaps have been published,
@@ -22,15 +23,15 @@ How to create a new release
.. code:: bash
- snap refresh --edge lpcraft
+ snap refresh --edge lpci
- in order to make sure nothing is broken, run
.. code:: bash
- lpcraft -v
+ lpci -v
-- go to the `Releases page <https://snapcraft.io/lpcraft/releases>`_
+- go to the `Releases page <https://snapcraft.io/lpci/releases>`_
of the Snap store to promote the release from ``edge`` to ``stable``
- click on the cog icon next to ``latest/edge``
@@ -44,7 +45,7 @@ Some additional information
- members of the Launchpad team can use the ``Request builds`` button
on that recipe if they need updated builds urgently
-- lpcraft currently only makes use of ``stable`` and ``edge``,
+- lpci currently only makes use of ``stable`` and ``edge``,
though this may change in future if necessary
- most users, as well as default CI builds in Launchpad,
diff --git a/docs/support.rst b/docs/support.rst
index 5746f8d..375dbec 100644
--- a/docs/support.rst
+++ b/docs/support.rst
@@ -6,7 +6,7 @@ Getting help
In case you need help, do not hesitate to reach out to us:
- https://answers.launchpad.net/lpcraft
+ https://answers.launchpad.net/lpci
If you work at Canonical, you can also visit the ~Launchpad channel on
Mattermost.
@@ -16,28 +16,28 @@ Bugs and feature requests
-------------------------
If you encounter a bug or you would like to have a new feature implemented,
-please report them at https://bugs.launchpad.net/lpcraft.
+please report them at https://bugs.launchpad.net/lpci.
Known issues
------------
Apart from the currently open
-`bug reports <https://bugs.launchpad.net/lpcraft>`_,
+`bug reports <https://bugs.launchpad.net/lpci>`_,
there are the following known issues for which there is no known solution:
- In order to keep the source tree clean,
- lpcraft mirrors the contents of the project into the lxd container
- (``/build/lpcraft/project/``).
+ lpci mirrors the contents of the project into the lxd container
+ (``/build/lpci/project/``).
This may have unexpected side effects when your current work tree is not
clean.
- This may also be a reason that the result you get when you run ``lpcraft``
+ This may also be a reason that the result you get when you run ``lpci``
on your machine and on CI may diverge.
- In order to ensure that you can use ``lpcraft`` to test code that has not yet
+ In order to ensure that you can use ``lpci`` to test code that has not yet
been committed,
we do not currently intend to change this behaviour.
However, you can simulate the behaviour of a CI run by making a fresh clone
- of your branch and running ``lpcraft`` there.
+ of your branch and running ``lpci`` there.
diff --git a/lpcraft/__init__.py b/lpci/__init__.py
similarity index 100%
rename from lpcraft/__init__.py
rename to lpci/__init__.py
diff --git a/lpcraft/_version.py b/lpci/_version.py
similarity index 77%
rename from lpcraft/_version.py
rename to lpci/_version.py
index 1271ff2..9a4526e 100644
--- a/lpcraft/_version.py
+++ b/lpci/_version.py
@@ -8,5 +8,5 @@ __all__ = [
import importlib.metadata
-version = importlib.metadata.version("lpcraft")
-version_description = f"lpcraft, version {version}"
+version = importlib.metadata.version("lpci")
+version_description = f"lpci, version {version}"
diff --git a/lpcraft/commands/__init__.py b/lpci/commands/__init__.py
similarity index 100%
rename from lpcraft/commands/__init__.py
rename to lpci/commands/__init__.py
diff --git a/lpcraft/commands/clean.py b/lpci/commands/clean.py
similarity index 92%
rename from lpcraft/commands/clean.py
rename to lpci/commands/clean.py
index fd908f2..bfd1287 100644
--- a/lpcraft/commands/clean.py
+++ b/lpci/commands/clean.py
@@ -6,8 +6,8 @@ from pathlib import Path
from craft_cli import BaseCommand, emit
-from lpcraft.config import Config
-from lpcraft.providers import get_provider
+from lpci.config import Config
+from lpci.providers import get_provider
class CleanCommand(BaseCommand):
@@ -30,7 +30,7 @@ class CleanCommand(BaseCommand):
def run(self, args: Namespace) -> int:
"""Run the command."""
- # We want to run the "clean" command only when run from an lpcraft
+ # We want to run the "clean" command only when run from an lpci
# project directory, so we load the config here even though we don't
# do anything with it.
Config.load(args.config)
diff --git a/lpcraft/commands/release.py b/lpci/commands/release.py
similarity index 97%
rename from lpcraft/commands/release.py
rename to lpci/commands/release.py
index 84ca2b9..d51e239 100644
--- a/lpcraft/commands/release.py
+++ b/lpci/commands/release.py
@@ -9,8 +9,8 @@ from urllib.parse import urlparse
from craft_cli import BaseCommand, emit
from launchpadlib.launchpad import Launchpad
-from lpcraft.errors import CommandError
-from lpcraft.git import get_current_branch, get_current_remote_url
+from lpci.errors import CommandError
+from lpci.git import get_current_branch, get_current_remote_url
class ReleaseCommand(BaseCommand):
@@ -87,7 +87,7 @@ class ReleaseCommand(BaseCommand):
)
launchpad = Launchpad.login_with(
- "lpcraft", args.launchpad_instance, version="devel"
+ "lpci", args.launchpad_instance, version="devel"
)
repository = launchpad.git_repositories.getByPath(path=args.repository)
if repository is None:
diff --git a/lpcraft/commands/run.py b/lpci/commands/run.py
similarity index 95%
rename from lpcraft/commands/run.py
rename to lpci/commands/run.py
index 3a914df..d6c65b2 100644
--- a/lpcraft/commands/run.py
+++ b/lpci/commands/run.py
@@ -23,8 +23,8 @@ from dotenv import dotenv_values
from jinja2 import BaseLoader, Environment
from pluggy import PluginManager
-from lpcraft import env
-from lpcraft.config import (
+from lpci import env
+from lpci.config import (
Config,
Input,
Job,
@@ -33,11 +33,11 @@ from lpcraft.config import (
PPAShortFormURL,
get_ppa_url_parts,
)
-from lpcraft.errors import CommandError
-from lpcraft.plugin.manager import get_plugin_manager
-from lpcraft.plugins import PLUGINS
-from lpcraft.providers import Provider, get_provider
-from lpcraft.utils import get_host_architecture
+from lpci.errors import CommandError
+from lpci.plugin.manager import get_plugin_manager
+from lpci.plugins import PLUGINS
+from lpci.providers import Provider, get_provider
+from lpci.utils import get_host_architecture
LAUNCHPAD_API_BASE_URL = "https://api.launchpad.net/devel"
@@ -487,19 +487,19 @@ def _run_job(
pre_run_command = _resolve_runtime_value(
pm,
job,
- hook_name="lpcraft_execute_before_run",
+ hook_name="lpci_execute_before_run",
job_property="run_before",
)
run_command = _resolve_runtime_value(
pm,
job,
- hook_name="lpcraft_execute_run",
+ hook_name="lpci_execute_run",
job_property="run",
)
post_run_command = _resolve_runtime_value(
pm,
job,
- hook_name="lpcraft_execute_after_run",
+ hook_name="lpci_execute_after_run",
job_property="run_after",
)
@@ -510,7 +510,7 @@ def _run_job(
)
# XXX jugmac00 2021-12-17: extract inferring environment variables
- rv = pm.hook.lpcraft_set_environment()
+ rv = pm.hook.lpci_set_environment()
if rv:
# XXX jugmac00 2021-12-17: check for length or reduce?
env_from_plugin = rv[0]
@@ -541,7 +541,7 @@ def _run_job(
architecture=host_architecture,
gpu_nvidia=gpu_nvidia,
) as instance:
- snaps = list(itertools.chain(*pm.hook.lpcraft_install_snaps()))
+ snaps = list(itertools.chain(*pm.hook.lpci_install_snaps()))
for snap in snaps:
emit.progress(
"Running `snap install "
@@ -555,7 +555,7 @@ def _run_job(
channel=snap.channel,
classic=snap.classic,
)
- packages = list(itertools.chain(*pm.hook.lpcraft_install_packages()))
+ packages = list(itertools.chain(*pm.hook.lpci_install_packages()))
if packages:
_install_apt_packages(
job_name=job_name,
diff --git a/lpcraft/commands/tests/__init__.py b/lpci/commands/tests/__init__.py
similarity index 94%
rename from lpcraft/commands/tests/__init__.py
rename to lpci/commands/tests/__init__.py
index aba747f..d415240 100644
--- a/lpcraft/commands/tests/__init__.py
+++ b/lpci/commands/tests/__init__.py
@@ -8,8 +8,8 @@ from unittest.mock import ANY, call
from craft_cli import CraftError
from testtools import TestCase
-from lpcraft.main import main
-from lpcraft.tests.fixtures import RecordingEmitterFixture
+from lpci.main import main
+from lpci.tests.fixtures import RecordingEmitterFixture
@dataclass
diff --git a/lpcraft/commands/tests/filter-wadl.py b/lpci/commands/tests/filter-wadl.py
similarity index 100%
rename from lpcraft/commands/tests/filter-wadl.py
rename to lpci/commands/tests/filter-wadl.py
diff --git a/lpcraft/commands/tests/launchpad-wadl.xml b/lpci/commands/tests/launchpad-wadl.xml
similarity index 100%
rename from lpcraft/commands/tests/launchpad-wadl.xml
rename to lpci/commands/tests/launchpad-wadl.xml
diff --git a/lpcraft/commands/tests/test_clean.py b/lpci/commands/tests/test_clean.py
similarity index 93%
rename from lpcraft/commands/tests/test_clean.py
rename to lpci/commands/tests/test_clean.py
index c445095..8c2d7c9 100644
--- a/lpcraft/commands/tests/test_clean.py
+++ b/lpci/commands/tests/test_clean.py
@@ -8,9 +8,9 @@ from unittest.mock import patch
from fixtures import TempDir
from testtools.matchers import MatchesStructure
-from lpcraft.commands.tests import CommandBaseTestCase
-from lpcraft.errors import CommandError, ConfigurationError
-from lpcraft.providers.tests import makeLXDProvider
+from lpci.commands.tests import CommandBaseTestCase
+from lpci.errors import CommandError, ConfigurationError
+from lpci.providers.tests import makeLXDProvider
class TestClean(CommandBaseTestCase):
@@ -70,7 +70,7 @@ class TestClean(CommandBaseTestCase):
tmp_config_file = os.path.join(
self.tmp_project_path,
- "test-clean-config/lpcraft-configuration.yaml",
+ "test-clean-config/lpci-configuration.yaml",
)
result = self.run_command("clean", "-c", tmp_config_file)
@@ -87,7 +87,7 @@ class TestClean(CommandBaseTestCase):
),
)
- @patch("lpcraft.commands.clean.get_provider")
+ @patch("lpci.commands.clean.get_provider")
def test_lxd_not_ready(self, mock_get_provider):
mock_get_provider.return_value = makeLXDProvider(is_ready=False)
Path(".launchpad.yaml").write_text("pipeline: []\njobs: {}")
@@ -102,8 +102,8 @@ class TestClean(CommandBaseTestCase):
),
)
- @patch("lpcraft.commands.clean.get_provider")
- @patch("lpcraft.providers._lxd.LXDProvider.clean_project_environments")
+ @patch("lpci.commands.clean.get_provider")
+ @patch("lpci.providers._lxd.LXDProvider.clean_project_environments")
def test_clean_cleans_project_environments(
self, mock_clean_project_environments, mock_get_provider
):
diff --git a/lpcraft/commands/tests/test_release.py b/lpci/commands/tests/test_release.py
similarity index 98%
rename from lpcraft/commands/tests/test_release.py
rename to lpci/commands/tests/test_release.py
index 1185c60..96649f4 100644
--- a/lpcraft/commands/tests/test_release.py
+++ b/lpci/commands/tests/test_release.py
@@ -12,8 +12,8 @@ from systemfixtures import FakeProcesses
from testtools.matchers import Equals, MatchesListwise, MatchesStructure
from wadllib.application import Application
-from lpcraft.commands.tests import CommandBaseTestCase
-from lpcraft.errors import CommandError
+from lpci.commands.tests import CommandBaseTestCase
+from lpci.errors import CommandError
class TestRelease(CommandBaseTestCase):
diff --git a/lpcraft/commands/tests/test_run.py b/lpci/commands/tests/test_run.py
similarity index 89%
rename from lpcraft/commands/tests/test_run.py
rename to lpci/commands/tests/test_run.py
index b1fc6c2..1cf9c4b 100644
--- a/lpcraft/commands/tests/test_run.py
+++ b/lpci/commands/tests/test_run.py
@@ -16,10 +16,10 @@ from craft_providers.lxd import LXC, launch
from fixtures import TempDir
from testtools.matchers import MatchesStructure
-from lpcraft.commands.run import LAUNCHPAD_API_BASE_URL
-from lpcraft.commands.tests import CommandBaseTestCase
-from lpcraft.errors import CommandError, ConfigurationError
-from lpcraft.providers.tests import makeLXDProvider
+from lpci.commands.run import LAUNCHPAD_API_BASE_URL
+from lpci.commands.tests import CommandBaseTestCase
+from lpci.errors import CommandError, ConfigurationError
+from lpci.providers.tests import makeLXDProvider
class LocalExecuteRun:
@@ -129,8 +129,8 @@ class TestRun(RunBaseTestCase):
),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_path_config_file(
self, mock_get_host_architecture, mock_get_provider
):
@@ -157,21 +157,21 @@ class TestRun(RunBaseTestCase):
run: pyproject-build
"""
)
- path = "%s/lpcraft-configuration.yaml" % self.tmp_config_path
+ path = "%s/lpci-configuration.yaml" % self.tmp_config_path
Path(path).write_text(config)
self.run_command("run", "-c", path)
execute_run.assert_called_once_with(
["bash", "--noprofile", "--norc", "-ec", "pyproject-build"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_lxd_not_ready(
self, mock_get_host_architecture, mock_get_provider
):
@@ -194,8 +194,8 @@ class TestRun(RunBaseTestCase):
),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_job_not_defined(
self, mock_get_host_architecture, mock_get_provider
):
@@ -220,8 +220,8 @@ class TestRun(RunBaseTestCase):
),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="arm64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="arm64")
def test_job_not_defined_for_host_architecture(
self, mock_get_host_architecture, mock_get_provider
):
@@ -263,7 +263,7 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -272,8 +272,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_no_run_definition(
self, mock_get_host_architecture, mock_get_provider
):
@@ -305,8 +305,8 @@ class TestRun(RunBaseTestCase):
),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_one_job_fails(
self, mock_get_host_architecture, mock_get_provider
):
@@ -351,14 +351,14 @@ class TestRun(RunBaseTestCase):
)
execute_run.assert_called_once_with(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_all_jobs_succeed(
self, mock_get_host_architecture, mock_get_provider
):
@@ -397,7 +397,7 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -410,7 +410,7 @@ class TestRun(RunBaseTestCase):
"-ec",
"pyproject-build",
],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -419,8 +419,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_apt_replace_repositories(
self, mock_get_host_architecture, mock_get_provider
):
@@ -453,21 +453,21 @@ class TestRun(RunBaseTestCase):
[
call(
["apt", "update"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["apt", "install", "-y", "git"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["bash", "--noprofile", "--norc", "-ec", "ls -la"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -486,8 +486,8 @@ class TestRun(RunBaseTestCase):
self.assertEqual("root", mock_info["user"])
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_importing_ppa_key_key_not_found(
self,
mock_get_host_architecture,
@@ -543,8 +543,8 @@ class TestRun(RunBaseTestCase):
)
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_importing_ppa_signing_key(
self,
mock_get_host_architecture,
@@ -646,8 +646,8 @@ class TestRun(RunBaseTestCase):
any_order=True,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_updating_package_info_fails(
self, mock_get_host_architecture, mock_get_provider
):
@@ -683,14 +683,14 @@ class TestRun(RunBaseTestCase):
[
call(
["apt", "update"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["apt", "install", "-y", "git"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -699,13 +699,13 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_default_to_run_command(
self, mock_get_host_architecture, mock_get_provider
):
- # calling `lpcraft` with no arguments triggers the run command
- # and is functionally equivalent to `lpcraft run`
+ # calling `lpci` with no arguments triggers the run command
+ # and is functionally equivalent to `lpci run`
launcher = Mock(spec=launch)
provider = makeLXDProvider(lxd_launcher=launcher)
mock_get_provider.return_value = provider
@@ -732,7 +732,7 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -741,8 +741,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_parallel_jobs_some_fail(
self, mock_get_host_architecture, mock_get_provider
):
@@ -806,7 +806,7 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", command],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -816,8 +816,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_parallel_jobs_all_succeed(
self, mock_get_host_architecture, mock_get_provider
):
@@ -865,7 +865,7 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", command],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -875,8 +875,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_expands_matrix(
self, mock_get_host_architecture, mock_get_provider
):
@@ -918,14 +918,14 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -938,7 +938,7 @@ class TestRun(RunBaseTestCase):
"-ec",
"pyproject-build",
],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -947,8 +947,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_set_environment_variables_via_configuration(
self, mock_get_host_architecture, mock_get_provider
):
@@ -980,7 +980,7 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={"TOX_SKIP_ENV": "^(?!lint-)"},
stdout=ANY,
stderr=ANY,
@@ -989,8 +989,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_set_environment_variables_via_cli(
self, mock_get_host_architecture, mock_get_provider
):
@@ -1022,7 +1022,7 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={"PIP_INDEX_URL": "http://pypi.example.com/simple"},
stdout=ANY,
stderr=ANY,
@@ -1031,9 +1031,9 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_copies_output_paths(
self,
mock_get_host_architecture,
@@ -1097,9 +1097,9 @@ class TestRun(RunBaseTestCase):
sorted(path.name for path in (job_output / "files").iterdir()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_output_path_in_immediate_parent(
self,
mock_get_host_architecture,
@@ -1157,9 +1157,9 @@ class TestRun(RunBaseTestCase):
sorted(path.name for path in (job_output / "files").iterdir()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_output_path_escapes_directly(
self,
mock_get_host_architecture,
@@ -1201,9 +1201,9 @@ class TestRun(RunBaseTestCase):
[error] = result.errors
self.assertIn("/etc/shadow", str(error))
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_output_path_escapes_symlink(
self,
mock_get_host_architecture,
@@ -1246,9 +1246,9 @@ class TestRun(RunBaseTestCase):
[error] = result.errors
self.assertIn("/target.txt", str(error))
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_output_path_pull_file_fails(
self,
mock_get_host_architecture,
@@ -1294,9 +1294,9 @@ class TestRun(RunBaseTestCase):
),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_shows_error_message_when_no_output_files(
self,
mock_get_host_architecture,
@@ -1341,9 +1341,9 @@ class TestRun(RunBaseTestCase):
),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_reads_properties(
self,
mock_get_host_architecture,
@@ -1386,9 +1386,9 @@ class TestRun(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_reads_dynamic_properties(
self,
mock_get_host_architecture,
@@ -1431,9 +1431,9 @@ class TestRun(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_dynamic_properties_override_properties(
self,
mock_get_host_architecture,
@@ -1481,9 +1481,9 @@ class TestRun(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_run_dynamic_properties_escapes_directly(
self,
mock_get_host_architecture,
@@ -1525,9 +1525,9 @@ class TestRun(RunBaseTestCase):
[error] = result.errors
self.assertIn("/properties", str(error))
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_run_dynamic_properties_escapes_symlink(
self,
mock_get_host_architecture,
@@ -1570,9 +1570,9 @@ class TestRun(RunBaseTestCase):
[error] = result.errors
self.assertIn("/target", str(error))
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_copies_input_paths(
self,
mock_get_host_architecture,
@@ -1682,9 +1682,9 @@ class TestRun(RunBaseTestCase):
b"", (artifacts_path / "files" / "dist" / "empty").read_bytes()
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_input_target_directory_not_previously_executed(
self,
mock_get_host_architecture,
@@ -1734,9 +1734,9 @@ class TestRun(RunBaseTestCase):
),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_input_target_directory_multiple_jobs(
self,
mock_get_host_architecture,
@@ -1790,9 +1790,9 @@ class TestRun(RunBaseTestCase):
r"the following paths: \[PosixPath\('.*'\), PosixPath\('.*'\)\]\.",
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_input_target_directory_escapes_directly(
self,
mock_get_host_architecture,
@@ -1843,9 +1843,9 @@ class TestRun(RunBaseTestCase):
[error] = result.errors
self.assertIn("/etc/secrets", str(error))
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_input_target_directory_escapes_symlink(
self,
mock_get_host_architecture,
@@ -1897,9 +1897,9 @@ class TestRun(RunBaseTestCase):
[error] = result.errors
self.assertIn("/secrets", str(error))
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_input_push_file_fails(
self,
mock_get_host_architecture,
@@ -1954,8 +1954,8 @@ class TestRun(RunBaseTestCase):
)
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_install_snaps_classic_parameter(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2047,7 +2047,7 @@ class TestRun(RunBaseTestCase):
),
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -2057,8 +2057,8 @@ class TestRun(RunBaseTestCase):
)
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_install_snaps_provided_as_list_of_strings(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2144,7 +2144,7 @@ class TestRun(RunBaseTestCase):
),
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -2154,8 +2154,8 @@ class TestRun(RunBaseTestCase):
)
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_install_snaps_wrong_array_format(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2188,8 +2188,8 @@ class TestRun(RunBaseTestCase):
)
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_install_snaps_channel_parameter(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2279,7 +2279,7 @@ class TestRun(RunBaseTestCase):
),
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -2289,8 +2289,8 @@ class TestRun(RunBaseTestCase):
)
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_install_snaps_snap_name_missing(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2323,8 +2323,8 @@ class TestRun(RunBaseTestCase):
)
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_install_snaps_snap_channel_none(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2359,8 +2359,8 @@ class TestRun(RunBaseTestCase):
)
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_install_snaps_snap_classic_none(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2396,8 +2396,8 @@ class TestRun(RunBaseTestCase):
)
@responses.activate
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_install_snaps_classic_wrong_value(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2432,8 +2432,8 @@ class TestRun(RunBaseTestCase):
+ "Valid values would either be `True` or `False`.",
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_install_system_packages(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2464,7 +2464,7 @@ class TestRun(RunBaseTestCase):
[
call(
["apt", "update"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -2477,14 +2477,14 @@ class TestRun(RunBaseTestCase):
"nginx",
"apache2",
],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -2493,8 +2493,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_installing_unknown_system_package_fails(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2525,7 +2525,7 @@ class TestRun(RunBaseTestCase):
[
call(
["apt", "update"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -2534,8 +2534,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
@patch("sys.stderr", new_callable=io.StringIO)
def test_quiet(
self, mock_stderr, mock_get_host_architecture, mock_get_provider
@@ -2568,8 +2568,8 @@ class TestRun(RunBaseTestCase):
self.assertEqual(0, result.exit_code)
self.assertEqual("", mock_stderr.getvalue())
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
@patch("sys.stderr", new_callable=io.StringIO)
def test_default_verbosity(
self, mock_stderr, mock_get_host_architecture, mock_get_provider
@@ -2611,9 +2611,9 @@ class TestRun(RunBaseTestCase):
)
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
- @patch("lpcraft.providers._lxd.LXDProvider.clean_project_environments")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.providers._lxd.LXDProvider.clean_project_environments")
def test_cleans_up_the_managed_environment(
self,
mock_clean_project_environments,
@@ -2671,10 +2671,10 @@ class TestRun(RunBaseTestCase):
],
)
- @patch("lpcraft.commands.run._run_job")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
- @patch("lpcraft.providers._lxd.LXDProvider.clean_project_environments")
+ @patch("lpci.commands.run._run_job")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.providers._lxd.LXDProvider.clean_project_environments")
def test_cleans_up_only_the_instances_created_for_the_current_run(
self,
mock_clean_project_environments,
@@ -2753,10 +2753,10 @@ class TestRun(RunBaseTestCase):
],
)
- @patch("lpcraft.commands.run._run_job")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
- @patch("lpcraft.providers._lxd.LXDProvider.clean_project_environments")
+ @patch("lpci.commands.run._run_job")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.providers._lxd.LXDProvider.clean_project_environments")
def test_cleans_up_only_the_instances_created_in_the_current_run_when_a_job_errors_out( # noqa: E501
self,
mock_clean_project_environments,
@@ -2816,8 +2816,8 @@ class TestRun(RunBaseTestCase):
],
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_set_environment_variables_via_cli_copes_with_equal_sign_in_value(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2850,7 +2850,7 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={
"DOUBLE_EQUAL": "value_with=another_equal_sign",
},
@@ -2861,8 +2861,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_set_environment_variables_via_cli_ensure_merge_order(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2899,7 +2899,7 @@ class TestRun(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={
"PIP_INDEX_URL": "http://local-pypi.example.com/simple"
},
@@ -2910,8 +2910,8 @@ class TestRun(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_run_with_additional_package_repositories(
self, mock_get_host_architecture, mock_get_provider
):
@@ -2971,8 +2971,8 @@ class TestRun(RunBaseTestCase):
file_contents,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_provide_package_repositories_via_config_with_secrets(
self, mock_get_host_architecture, mock_get_provider
):
@@ -3025,21 +3025,21 @@ class TestRun(RunBaseTestCase):
[
call(
["apt", "update"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["apt", "install", "-y", "git"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["bash", "--noprofile", "--norc", "-ec", "ls -la"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -3066,8 +3066,8 @@ class TestRun(RunBaseTestCase):
file_contents,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_run_provide_package_repositories_via_cli(
self, mock_get_host_architecture, mock_get_provider
):
@@ -3121,8 +3121,8 @@ class TestRun(RunBaseTestCase):
file_contents,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_provide_package_repositories_via_cli_and_configuration(
self, mock_get_host_architecture, mock_get_provider
):
@@ -3187,9 +3187,9 @@ class TestRun(RunBaseTestCase):
file_contents,
)
- @patch("lpcraft.commands.run._import_signing_keys_for_ppas")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run._import_signing_keys_for_ppas")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_per_job_package_repositories_are_isolated_to_corresponding_jobs(
self,
mock_get_host_architecture,
@@ -3274,9 +3274,9 @@ class TestRun(RunBaseTestCase):
job2_sources_list,
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_license_field_spdx_gets_written_to_properties(
self,
mock_get_host_architecture,
@@ -3318,9 +3318,9 @@ class TestRun(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_license_field_path_gets_written_to_properties(
self,
mock_get_host_architecture,
@@ -3362,9 +3362,9 @@ class TestRun(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_license_field_works_with_output_but_no_properties(
self,
mock_get_host_architecture,
@@ -3408,9 +3408,9 @@ class TestRun(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_license_field_works_also_with_other_properties(
self,
mock_get_host_architecture,
@@ -3455,8 +3455,8 @@ class TestRun(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_no_gpu_nvidia_option(
self, mock_get_host_architecture, mock_get_provider
):
@@ -3494,8 +3494,8 @@ class TestRun(RunBaseTestCase):
remote="test-remote",
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_gpu_nvidia_option(
self, mock_get_host_architecture, mock_get_provider
):
@@ -3585,8 +3585,8 @@ class TestRunOne(RunBaseTestCase):
),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_path_config_file(
self, mock_get_host_architecture, mock_get_provider
):
@@ -3628,14 +3628,14 @@ class TestRunOne(RunBaseTestCase):
execute_run.assert_called_once_with(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_job_not_defined(
self, mock_get_host_architecture, mock_get_provider
):
@@ -3660,8 +3660,8 @@ class TestRunOne(RunBaseTestCase):
),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_job_index_not_defined(
self, mock_get_host_architecture, mock_get_provider
):
@@ -3692,8 +3692,8 @@ class TestRunOne(RunBaseTestCase):
),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_job_fails(self, mock_get_host_architecture, mock_get_provider):
launcher = Mock(spec=launch)
provider = makeLXDProvider(lxd_launcher=launcher)
@@ -3736,14 +3736,14 @@ class TestRunOne(RunBaseTestCase):
)
execute_run.assert_called_once_with(
["bash", "--noprofile", "--norc", "-ec", "pyproject-build"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_expands_matrix(
self, mock_get_host_architecture, mock_get_provider
):
@@ -3784,15 +3784,15 @@ class TestRunOne(RunBaseTestCase):
)
execute_run.assert_called_once_with(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_copies_output_paths(
self,
mock_get_host_architecture,
@@ -3856,9 +3856,9 @@ class TestRunOne(RunBaseTestCase):
sorted(path.name for path in (job_output / "files").iterdir()),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
- @patch("lpcraft.providers._lxd.LXDProvider.clean_project_environments")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.providers._lxd.LXDProvider.clean_project_environments")
def test_run_one_clean_flag_cleans_up_even_when_there_are_errors(
self,
mock_clean_project_environments,
@@ -3914,9 +3914,9 @@ class TestRunOne(RunBaseTestCase):
instances=instance_names,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
- @patch("lpcraft.providers._lxd.LXDProvider.clean_project_environments")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.providers._lxd.LXDProvider.clean_project_environments")
def test_run_one_clean_flag_cleans_up_the_managed_environment(
self,
mock_clean_project_environments,
@@ -3970,8 +3970,8 @@ class TestRunOne(RunBaseTestCase):
instances=instance_names,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_apt_replace_repositories(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4004,21 +4004,21 @@ class TestRunOne(RunBaseTestCase):
[
call(
["apt", "update"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["apt", "install", "-y", "git"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["bash", "--noprofile", "--norc", "-ec", "ls -la"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -4036,8 +4036,8 @@ class TestRunOne(RunBaseTestCase):
self.assertEqual("root", mock_info["group"])
self.assertEqual("root", mock_info["user"])
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_set_environment_variables_via_cli(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4073,7 +4073,7 @@ class TestRunOne(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={"PIP_INDEX_URL": "http://pypi.example.com/simple"},
stdout=ANY,
stderr=ANY,
@@ -4082,8 +4082,8 @@ class TestRunOne(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_set_environment_variables_via_cli_copes_with_equal_sign_in_value(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4118,7 +4118,7 @@ class TestRunOne(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={
"DOUBLE_EQUAL": "value_with=another_equal_sign",
},
@@ -4129,8 +4129,8 @@ class TestRunOne(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_set_environment_variables_via_cli_ensure_merge_order(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4169,7 +4169,7 @@ class TestRunOne(RunBaseTestCase):
[
call(
["bash", "--noprofile", "--norc", "-ec", "tox"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={
"PIP_INDEX_URL": "http://local-pypi.example.com/simple"
},
@@ -4180,8 +4180,8 @@ class TestRunOne(RunBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_run_with_additional_package_repositories(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4240,9 +4240,9 @@ class TestRunOne(RunBaseTestCase):
file_contents,
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_fails_pulling_sources_list(
self,
mock_get_host_architecture,
@@ -4286,8 +4286,8 @@ class TestRunOne(RunBaseTestCase):
),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_provide_secrets_file_via_cli(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4324,8 +4324,8 @@ class TestRunOne(RunBaseTestCase):
"'--secrets', '.launchpad-secrets.yaml'", result.trace[0]
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_provide_package_repositories_via_config_with_secrets(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4380,21 +4380,21 @@ class TestRunOne(RunBaseTestCase):
[
call(
["apt", "update"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["apt", "install", "-y", "git"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["bash", "--noprofile", "--norc", "-ec", "ls -la"],
- cwd=Path("/build/lpcraft/project"),
+ cwd=Path("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -4421,8 +4421,8 @@ class TestRunOne(RunBaseTestCase):
file_contents,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_run_provide_package_repositories_via_cli(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4478,8 +4478,8 @@ class TestRunOne(RunBaseTestCase):
file_contents,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_provide_package_repositories_via_cli_and_configuration(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4542,9 +4542,9 @@ class TestRunOne(RunBaseTestCase):
file_contents,
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_license_field_spdx_gets_written_to_properties(
self,
mock_get_host_architecture,
@@ -4586,9 +4586,9 @@ class TestRunOne(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_license_field_path_gets_written_to_properties(
self,
mock_get_host_architecture,
@@ -4630,9 +4630,9 @@ class TestRunOne(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.env.get_managed_environment_project_path")
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.env.get_managed_environment_project_path")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_license_field_works_also_with_other_properties(
self,
mock_get_host_architecture,
@@ -4677,8 +4677,8 @@ class TestRunOne(RunBaseTestCase):
json.loads((job_output / "properties").read_text()),
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_no_gpu_nvidia_option(
self, mock_get_host_architecture, mock_get_provider
):
@@ -4716,8 +4716,8 @@ class TestRunOne(RunBaseTestCase):
remote="test-remote",
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_gpu_nvidia_option(
self, mock_get_host_architecture, mock_get_provider
):
diff --git a/lpcraft/commands/tests/test_version.py b/lpci/commands/tests/test_version.py
similarity index 92%
rename from lpcraft/commands/tests/test_version.py
rename to lpci/commands/tests/test_version.py
index a50aa54..f811bce 100644
--- a/lpcraft/commands/tests/test_version.py
+++ b/lpci/commands/tests/test_version.py
@@ -1,7 +1,7 @@
# Copyright 2021 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
-from lpcraft.commands.tests import CommandBaseTestCase
+from lpci.commands.tests import CommandBaseTestCase
class VersionTestCase(CommandBaseTestCase):
diff --git a/lpcraft/commands/version.py b/lpci/commands/version.py
similarity index 80%
rename from lpcraft/commands/version.py
rename to lpci/commands/version.py
index 94acff7..b527140 100644
--- a/lpcraft/commands/version.py
+++ b/lpci/commands/version.py
@@ -5,11 +5,11 @@ from argparse import Namespace
from craft_cli import BaseCommand, emit
-from lpcraft._version import version_description as lpcraft_version
+from lpci._version import version_description as lpci_version
class VersionCommand(BaseCommand):
- """Show lpcraft's version number."""
+ """Show lpci's version number."""
name = "version"
help_msg = __doc__.splitlines()[0]
@@ -18,5 +18,5 @@ class VersionCommand(BaseCommand):
def run(self, args: Namespace) -> int:
"""Run the command."""
- emit.message(lpcraft_version)
+ emit.message(lpci_version)
return 0
diff --git a/lpcraft/config.py b/lpci/config.py
similarity index 98%
rename from lpcraft/config.py
rename to lpci/config.py
index 0d3db3d..c402afb 100644
--- a/lpcraft/config.py
+++ b/lpci/config.py
@@ -11,10 +11,10 @@ import pydantic
from craft_cli import emit
from pydantic import AnyHttpUrl, StrictStr, root_validator, validator
-from lpcraft.errors import ConfigurationError
-from lpcraft.plugins import PLUGINS
-from lpcraft.plugins.plugins import BaseConfig, BasePlugin
-from lpcraft.utils import load_yaml
+from lpci.errors import ConfigurationError
+from lpci.plugins import PLUGINS
+from lpci.plugins.plugins import BaseConfig, BasePlugin
+from lpci.utils import load_yaml
LAUNCHPAD_PPA_BASE_URL = "https://ppa.launchpadcontent.net"
@@ -36,7 +36,7 @@ class ModelConfigDefaults(
alias_generator=lambda s: s.replace("_", "-"),
underscore_attrs_are_private=True,
):
- """Define lpcraft's model defaults."""
+ """Define lpci's model defaults."""
class OutputDistributeEnum(Enum):
diff --git a/lpcraft/env.py b/lpci/env.py
similarity index 80%
rename from lpcraft/env.py
rename to lpci/env.py
index 309e79b..cfc7331 100644
--- a/lpcraft/env.py
+++ b/lpci/env.py
@@ -1,7 +1,7 @@
# Copyright 2021 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
-"""lpcraft environment utilities."""
+"""lpci environment utilities."""
from pathlib import Path
@@ -13,4 +13,4 @@ def get_managed_environment_home_path() -> Path:
def get_managed_environment_project_path() -> Path:
"""Path for project when running in managed environment."""
- return Path("/build/lpcraft/project")
+ return Path("/build/lpci/project")
diff --git a/lpcraft/errors.py b/lpci/errors.py
similarity index 94%
rename from lpcraft/errors.py
rename to lpci/errors.py
index 6f0f7c3..3f45abb 100644
--- a/lpcraft/errors.py
+++ b/lpci/errors.py
@@ -1,7 +1,7 @@
# Copyright 2021 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
-"""lpcraft errors."""
+"""lpci errors."""
__all__ = [
"CommandError",
diff --git a/lpcraft/git.py b/lpci/git.py
similarity index 100%
rename from lpcraft/git.py
rename to lpci/git.py
diff --git a/lpcraft/main.py b/lpci/main.py
similarity index 89%
rename from lpcraft/main.py
rename to lpci/main.py
index 6b27e37..c84126d 100644
--- a/lpcraft/main.py
+++ b/lpci/main.py
@@ -18,11 +18,11 @@ from craft_cli import (
emit,
)
-from lpcraft._version import version_description as lpcraft_version
-from lpcraft.commands.clean import CleanCommand
-from lpcraft.commands.release import ReleaseCommand
-from lpcraft.commands.run import RunCommand, RunOneCommand
-from lpcraft.commands.version import VersionCommand
+from lpci._version import version_description as lpci_version
+from lpci.commands.clean import CleanCommand
+from lpci.commands.release import ReleaseCommand
+from lpci.commands.run import RunCommand, RunOneCommand
+from lpci.commands.version import VersionCommand
def _configure_logger(name: str) -> None:
@@ -50,11 +50,11 @@ _launchpad_commands = [
def main(argv: Optional[List[str]] = None) -> int:
- """`lpcraft` runs Launchpad CI jobs."""
+ """`lpci` runs Launchpad CI jobs."""
if argv is None:
argv = sys.argv[1:]
- emit.init(EmitterMode.BRIEF, "lpcraft", f"Starting {lpcraft_version}")
+ emit.init(EmitterMode.BRIEF, "lpci", f"Starting {lpci_version}")
command_groups = [
CommandGroup("Basic", _basic_commands),
CommandGroup("Launchpad", _launchpad_commands),
@@ -71,7 +71,7 @@ def main(argv: Optional[List[str]] = None) -> int:
]
# dispatcher = Dispatcher(
- # "lpcraft",
+ # "lpci",
# command_groups,
# summary=summary,
# extra_global_args=extra_global_args,
@@ -79,7 +79,7 @@ def main(argv: Optional[List[str]] = None) -> int:
# )
# global_args = dispatcher.pre_parse_args(argv)
# if global_args["version"]:
- # emit.message(lpcraft_version)
+ # emit.message(lpci_version)
# emit.ended_ok()
# return 0
# dispatcher.load_command(None)
@@ -87,7 +87,7 @@ def main(argv: Optional[List[str]] = None) -> int:
try:
dispatcher = Dispatcher(
- "lpcraft",
+ "lpci",
command_groups,
summary=summary,
extra_global_args=extra_global_args,
@@ -95,7 +95,7 @@ def main(argv: Optional[List[str]] = None) -> int:
)
global_args = dispatcher.pre_parse_args(argv)
if global_args["version"]:
- emit.message(lpcraft_version)
+ emit.message(lpci_version)
emit.ended_ok()
return 0
dispatcher.load_command(None)
@@ -117,7 +117,7 @@ def main(argv: Optional[List[str]] = None) -> int:
emit.error(error)
ret = 1
except Exception as e:
- error = CraftError(f"lpcraft internal error: {e!r}")
+ error = CraftError(f"lpci internal error: {e!r}")
error.__cause__ = e
emit.error(error)
ret = 1
diff --git a/lpcraft/plugin/__init__.py b/lpci/plugin/__init__.py
similarity index 57%
rename from lpcraft/plugin/__init__.py
rename to lpci/plugin/__init__.py
index 1a01a6c..a3ab6b4 100644
--- a/lpcraft/plugin/__init__.py
+++ b/lpci/plugin/__init__.py
@@ -5,8 +5,6 @@ __all__ = ["NAME", "hookimpl"]
import pluggy
-NAME = "lpcraft" #: name of the hook
+NAME = "lpci" #: name of the hook
-hookimpl = pluggy.HookimplMarker(
- NAME
-) #: decorator to mark lpcraft plugin hooks
+hookimpl = pluggy.HookimplMarker(NAME) #: decorator to mark lpci plugin hooks
diff --git a/lpcraft/plugin/hookspecs.py b/lpci/plugin/hookspecs.py
similarity index 65%
rename from lpcraft/plugin/hookspecs.py
rename to lpci/plugin/hookspecs.py
index ddb3b8a..aee2b34 100644
--- a/lpcraft/plugin/hookspecs.py
+++ b/lpci/plugin/hookspecs.py
@@ -4,33 +4,33 @@
from __future__ import annotations
__all__ = [
- "lpcraft_install_packages",
- "lpcraft_install_snaps",
- "lpcraft_execute_run",
- "lpcraft_execute_before_run",
- "lpcraft_execute_after_run",
- "lpcraft_set_environment",
+ "lpci_install_packages",
+ "lpci_install_snaps",
+ "lpci_execute_run",
+ "lpci_execute_before_run",
+ "lpci_execute_after_run",
+ "lpci_set_environment",
]
import pluggy
-from lpcraft.plugin import NAME
+from lpci.plugin import NAME
hookspec = pluggy.HookspecMarker(NAME)
@hookspec # type: ignore
-def lpcraft_install_packages() -> list[str]:
+def lpci_install_packages() -> list[str]:
"""System packages to be installed."""
@hookspec # type: ignore
-def lpcraft_install_snaps() -> list[str]:
+def lpci_install_snaps() -> list[str]:
"""Snaps to be installed."""
@hookspec # type: ignore
-def lpcraft_execute_run() -> str:
+def lpci_execute_run() -> str:
"""Command to be executed."""
# Please note: when both a plugin and the configuration file are
# providing a `run` command, the one from the configuration file will be
@@ -38,7 +38,7 @@ def lpcraft_execute_run() -> str:
@hookspec # type: ignore
-def lpcraft_set_environment() -> dict[str, str | None]:
+def lpci_set_environment() -> dict[str, str | None]:
"""Environment variables to be set."""
# Please note: when there is the same environment variable provided by
# the plugin and the configuration file, the one in the configuration
@@ -46,10 +46,10 @@ def lpcraft_set_environment() -> dict[str, str | None]:
@hookspec # type: ignore
-def lpcraft_execute_before_run() -> str:
+def lpci_execute_before_run() -> str:
"""Command to execute prior to the main execution body."""
@hookspec # type: ignore
-def lpcraft_execute_after_run() -> str:
+def lpci_execute_after_run() -> str:
"""Command to execute after the main execution body."""
diff --git a/lpcraft/plugin/lib.py b/lpci/plugin/lib.py
similarity index 78%
rename from lpcraft/plugin/lib.py
rename to lpci/plugin/lib.py
index 92510e6..acb61ea 100644
--- a/lpcraft/plugin/lib.py
+++ b/lpci/plugin/lib.py
@@ -2,7 +2,7 @@
see https://pluggy.readthedocs.io/en/stable/#define-and-collect-hooks
-Internal plugins provide the base functionality for lpcraft, which means that
+Internal plugins provide the base functionality for lpci, which means that
these plugins cannot be removed without breaking the application.
The provided functionality can be extended by additional plugins.
@@ -10,8 +10,8 @@ The provided functionality can be extended by additional plugins.
from __future__ import annotations
-from lpcraft.config import Job, Snap
-from lpcraft.plugin import hookimpl
+from lpci.config import Job, Snap
+from lpci.plugin import hookimpl
class InternalPlugins:
@@ -22,13 +22,13 @@ class InternalPlugins:
self.config = config
@hookimpl # type: ignore
- def lpcraft_install_packages(self) -> list[str]:
+ def lpci_install_packages(self) -> list[str]:
if self.config.packages:
return self.config.packages
return []
@hookimpl # type: ignore
- def lpcraft_install_snaps(self) -> list[Snap]:
+ def lpci_install_snaps(self) -> list[Snap]:
if self.config.snaps:
return self.config.snaps
return []
diff --git a/lpcraft/plugin/manager.py b/lpci/plugin/manager.py
similarity index 76%
rename from lpcraft/plugin/manager.py
rename to lpci/plugin/manager.py
index 036da3e..dc234d9 100644
--- a/lpcraft/plugin/manager.py
+++ b/lpci/plugin/manager.py
@@ -2,10 +2,10 @@ from typing import Dict, Optional
import pluggy
-from lpcraft.config import Job
-from lpcraft.plugin import NAME, hookspecs
-from lpcraft.plugin.lib import InternalPlugins
-from lpcraft.plugins import PLUGINS
+from lpci.config import Job
+from lpci.plugin import NAME, hookspecs
+from lpci.plugin.lib import InternalPlugins
+from lpci.plugins import PLUGINS
def get_plugin_manager(
diff --git a/lpcraft/plugin/tests/__init__.py b/lpci/plugin/tests/__init__.py
similarity index 100%
rename from lpcraft/plugin/tests/__init__.py
rename to lpci/plugin/tests/__init__.py
diff --git a/lpcraft/plugin/tests/test_plugins.py b/lpci/plugin/tests/test_plugins.py
similarity index 87%
rename from lpcraft/plugin/tests/test_plugins.py
rename to lpci/plugin/tests/test_plugins.py
index 1def73b..cddc68a 100644
--- a/lpcraft/plugin/tests/test_plugins.py
+++ b/lpci/plugin/tests/test_plugins.py
@@ -12,13 +12,13 @@ from craft_providers.lxd import launch
from fixtures import TempDir
from pydantic import StrictStr, ValidationError, validator
-import lpcraft.config
-from lpcraft.commands.tests import CommandBaseTestCase
-from lpcraft.errors import ConfigurationError
-from lpcraft.plugin.manager import get_plugin_manager
-from lpcraft.plugins import register
-from lpcraft.plugins.plugins import BaseConfig, BasePlugin
-from lpcraft.providers.tests import makeLXDProvider
+import lpci.config
+from lpci.commands.tests import CommandBaseTestCase
+from lpci.errors import ConfigurationError
+from lpci.plugin.manager import get_plugin_manager
+from lpci.plugins import register
+from lpci.plugins.plugins import BaseConfig, BasePlugin
+from lpci.providers.tests import makeLXDProvider
class TestPlugins(CommandBaseTestCase):
@@ -29,8 +29,8 @@ class TestPlugins(CommandBaseTestCase):
os.chdir(tempdir)
self.addCleanup(os.chdir, cwd)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_tox_plugin(self, mock_get_host_architecture, mock_get_provider):
launcher = Mock(spec=launch)
provider = makeLXDProvider(lxd_launcher=launcher)
@@ -58,7 +58,7 @@ class TestPlugins(CommandBaseTestCase):
[
call(
["apt", "update"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
@@ -72,7 +72,7 @@ class TestPlugins(CommandBaseTestCase):
"nginx",
"apache2",
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
@@ -85,7 +85,7 @@ class TestPlugins(CommandBaseTestCase):
"-ec",
"python3 -m pip install tox==3.24.5; tox",
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
@@ -94,8 +94,8 @@ class TestPlugins(CommandBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_execute_unknown_plugin(
self, mock_get_host_architecture, mock_get_provider
):
@@ -125,8 +125,8 @@ class TestPlugins(CommandBaseTestCase):
self.assertEqual(1, result.exit_code)
self.assertEqual([ConfigurationError("Unknown plugin")], result.errors)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_run_command_from_configuration_takes_precedence(
self, mock_get_host_architecture, mock_get_provider
):
@@ -157,7 +157,7 @@ class TestPlugins(CommandBaseTestCase):
[
call(
["apt", "update"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
@@ -171,14 +171,14 @@ class TestPlugins(CommandBaseTestCase):
"nginx",
"apache2",
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
),
call(
["bash", "--noprofile", "--norc", "-ec", "ls"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
@@ -187,8 +187,8 @@ class TestPlugins(CommandBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_pyproject_build_plugin(
self, mock_get_host_architecture, mock_get_provider
):
@@ -217,7 +217,7 @@ class TestPlugins(CommandBaseTestCase):
[
call(
["apt", "update"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -230,7 +230,7 @@ class TestPlugins(CommandBaseTestCase):
"python3-pip",
"python3-venv",
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -243,7 +243,7 @@ class TestPlugins(CommandBaseTestCase):
"-ec",
"python3 -m pip install build==0.7.0; python3 -m build", # noqa: E501
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -267,7 +267,7 @@ class TestPlugins(CommandBaseTestCase):
)
config_path = Path(".launchpad.yaml")
config_path.write_text(config)
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
self.assertEqual(config_obj.jobs["build"][0].plugin, "pyproject-build")
pm = get_plugin_manager(config_obj.jobs["build"][0])
plugins = pm.get_plugins()
@@ -313,7 +313,7 @@ class TestPlugins(CommandBaseTestCase):
def get_plugin_config(self) -> "FakePlugin.Config":
return cast(FakePlugin.Config, self.config.plugin_config)
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
job = config_obj.jobs["build"][0]
pm = get_plugin_manager(job)
plugins = pm.get_plugins()
@@ -325,8 +325,8 @@ class TestPlugins(CommandBaseTestCase):
self.assertEqual(plugin_config.python_version, "3.8")
self.assertIsNone(getattr(plugin_config, "series", None))
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_miniconda_plugin(
self, mock_get_host_architecture, mock_get_provider
):
@@ -388,7 +388,7 @@ class TestPlugins(CommandBaseTestCase):
[
call(
["apt", "update"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -404,7 +404,7 @@ class TestPlugins(CommandBaseTestCase):
"python3-venv",
"wget",
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -417,7 +417,7 @@ class TestPlugins(CommandBaseTestCase):
"-ec",
pre_run_command,
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -430,7 +430,7 @@ class TestPlugins(CommandBaseTestCase):
"-ec",
run_command,
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -443,7 +443,7 @@ class TestPlugins(CommandBaseTestCase):
"-ec",
post_run_command,
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -469,7 +469,7 @@ class TestPlugins(CommandBaseTestCase):
)
config_path = Path(".launchpad.yaml")
config_path.write_text(config)
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
self.assertEqual(config_obj.jobs["build"][0].plugin, "miniconda")
pm = get_plugin_manager(config_obj.jobs["build"][0])
plugins = pm.get_plugins()
@@ -484,8 +484,8 @@ class TestPlugins(CommandBaseTestCase):
)
self.assertEqual(["PYTHON=3.8", "pip"], plugin_match[0].conda_packages)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_conda_build_plugin(
self, mock_get_host_architecture, mock_get_provider
):
@@ -554,7 +554,7 @@ class TestPlugins(CommandBaseTestCase):
self.assertEqual(
call(
["apt", "update"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -587,7 +587,7 @@ class TestPlugins(CommandBaseTestCase):
"libtool",
"zlib1g-dev",
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -603,7 +603,7 @@ class TestPlugins(CommandBaseTestCase):
"-ec",
pre_run_command,
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -619,7 +619,7 @@ class TestPlugins(CommandBaseTestCase):
"-ec",
run_command,
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -635,7 +635,7 @@ class TestPlugins(CommandBaseTestCase):
"-ec",
post_run_command,
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={"CONDA_ENV": "lpci"},
stdout=ANY,
stderr=ANY,
@@ -670,7 +670,7 @@ class TestPlugins(CommandBaseTestCase):
meta_yaml = Path("info/recipe/meta.yaml")
meta_yaml.parent.mkdir(parents=True)
meta_yaml.touch()
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
self.assertEqual(config_obj.jobs["build"][0].plugin, "conda-build")
pm = get_plugin_manager(config_obj.jobs["build"][0])
plugins = pm.get_plugins()
@@ -708,7 +708,7 @@ class TestPlugins(CommandBaseTestCase):
parent_path.mkdir()
parent_path.joinpath("some_file.yaml").touch()
meta_yaml.touch()
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
self.assertEqual(config_obj.jobs["build"][0].plugin, "conda-build")
pm = get_plugin_manager(config_obj.jobs["build"][0])
plugins = pm.get_plugins()
@@ -746,7 +746,7 @@ class TestPlugins(CommandBaseTestCase):
parent_meta_yaml.parent.mkdir(parents=True)
meta_yaml.touch()
parent_meta_yaml.touch()
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
self.assertEqual(config_obj.jobs["build"][0].plugin, "conda-build")
pm = get_plugin_manager(config_obj.jobs["build"][0])
plugins = pm.get_plugins()
@@ -798,7 +798,7 @@ class TestPlugins(CommandBaseTestCase):
variant_config.touch()
parent_variant_config.touch()
parent_meta_yaml.touch()
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
self.assertEqual(config_obj.jobs["build"][0].plugin, "conda-build")
pm = get_plugin_manager(config_obj.jobs["build"][0])
plugins = pm.get_plugins()
@@ -809,7 +809,7 @@ class TestPlugins(CommandBaseTestCase):
[parent_variant_config.as_posix(), variant_config.as_posix()],
plugin_match[0].build_configs,
)
- self.assertEqual(run_command, plugin_match[0].lpcraft_execute_run())
+ self.assertEqual(run_command, plugin_match[0].lpci_execute_run())
def test_conda_build_plugin_renames_recipe_templates(self):
config = dedent(
@@ -839,7 +839,7 @@ class TestPlugins(CommandBaseTestCase):
meta_yaml.parent.mkdir(parents=True)
meta_yaml.touch()
template_meta_yaml.touch()
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
self.assertEqual(config_obj.jobs["build"][0].plugin, "conda-build")
pm = get_plugin_manager(config_obj.jobs["build"][0])
plugins = pm.get_plugins()
@@ -872,7 +872,7 @@ class TestPlugins(CommandBaseTestCase):
)
config_path = Path(".launchpad.yaml")
config_path.write_text(config)
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
self.assertRaisesRegex(
RuntimeError,
"No build target found",
@@ -909,7 +909,7 @@ class TestPlugins(CommandBaseTestCase):
# there is a recipe folder, but no meta.yaml file
meta_yaml = Path("info/recipe/")
meta_yaml.mkdir(parents=True)
- config_obj = lpcraft.config.Config.load(config_path)
+ config_obj = lpci.config.Config.load(config_path)
self.assertRaisesRegex(
RuntimeError,
"No build target found",
@@ -917,8 +917,8 @@ class TestPlugins(CommandBaseTestCase):
config_obj.jobs["build"][0],
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_additional_settings(
self, mock_get_host_architecture, mock_get_provider
):
@@ -962,8 +962,8 @@ class TestPlugins(CommandBaseTestCase):
self.assertEqual(0, result.exit_code)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_golang_plugin(
self, mock_get_host_architecture, mock_get_provider
):
@@ -994,14 +994,14 @@ class TestPlugins(CommandBaseTestCase):
[
call(
["apt", "update"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
),
call(
["apt", "install", "-y", "golang-1.17", "file", "git"],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -1014,7 +1014,7 @@ class TestPlugins(CommandBaseTestCase):
"-ec",
"\nexport PATH=/usr/lib/go-1.17/bin/:$PATH\ngo build -x examples/go-top.go", # noqa: E501
],
- cwd=PosixPath("/build/lpcraft/project"),
+ cwd=PosixPath("/build/lpci/project"),
env={},
stdout=ANY,
stderr=ANY,
@@ -1023,8 +1023,8 @@ class TestPlugins(CommandBaseTestCase):
execute_run.call_args_list,
)
- @patch("lpcraft.commands.run.get_provider")
- @patch("lpcraft.commands.run.get_host_architecture", return_value="amd64")
+ @patch("lpci.commands.run.get_provider")
+ @patch("lpci.commands.run.get_host_architecture", return_value="amd64")
def test_golang_plugin_with_illegal_version(
self, mock_get_host_architecture, mock_get_provider
):
@@ -1077,6 +1077,6 @@ class TestPlugins(CommandBaseTestCase):
self.assertRaises(
ValidationError,
- lpcraft.config.Config.load,
+ lpci.config.Config.load,
config_path,
)
diff --git a/lpcraft/plugins/__init__.py b/lpci/plugins/__init__.py
similarity index 86%
rename from lpcraft/plugins/__init__.py
rename to lpci/plugins/__init__.py
index 205d284..38cd38d 100644
--- a/lpcraft/plugins/__init__.py
+++ b/lpci/plugins/__init__.py
@@ -10,7 +10,7 @@ def register(name: str) -> Callable[[TypeT], TypeT]:
# this function registers all decorated plugin classes
# the result looks like:
#
- # PLUGINS = {'tox': <class 'lpcraft.plugins.plugins.ToxPlugin'>}
+ # PLUGINS = {'tox': <class 'lpci.plugins.plugins.ToxPlugin'>}
def inner(cls: TypeT) -> TypeT:
PLUGINS[name] = cls
return cls
@@ -20,4 +20,4 @@ def register(name: str) -> Callable[[TypeT], TypeT]:
# for registration all modules which contain plugins need to be imported
# the imports must be at the bottom of the module to avoid circular imports
-from lpcraft.plugins import plugins # noqa: F401, E402
+from lpci.plugins import plugins # noqa: F401, E402
diff --git a/lpcraft/plugins/plugins.py b/lpci/plugins/plugins.py
similarity index 87%
rename from lpcraft/plugins/plugins.py
rename to lpci/plugins/plugins.py
index 4dbad96..07745d5 100644
--- a/lpcraft/plugins/plugins.py
+++ b/lpci/plugins/plugins.py
@@ -18,13 +18,13 @@ from typing import TYPE_CHECKING, ClassVar, Dict, List, Optional, cast
import pydantic
from pydantic import StrictStr
-from lpcraft.plugin import hookimpl
-from lpcraft.plugins import register
+from lpci.plugin import hookimpl
+from lpci.plugins import register
# XXX: techalchemy 2022-03-25: prevent circular import of Job class
if TYPE_CHECKING:
- from lpcraft.config import Job # pragma: no cover
+ from lpci.config import Job # pragma: no cover
class BaseConfig(
@@ -65,17 +65,17 @@ class ToxPlugin(BasePlugin):
"""
@hookimpl # type: ignore
- def lpcraft_install_packages(self) -> list[str]:
+ def lpci_install_packages(self) -> list[str]:
return ["python3-pip"]
@hookimpl # type: ignore
- def lpcraft_execute_run(self) -> str:
+ def lpci_execute_run(self) -> str:
# XXX jugmac00 2022-01-07: we should consider using a requirements.txt
# as this allows updating via `pip-tools`
return "python3 -m pip install tox==3.24.5; tox"
@hookimpl # type: ignore
- def lpcraft_set_environment(self) -> dict[str, str | None]:
+ def lpci_set_environment(self) -> dict[str, str | None]:
# Work around https://github.com/tox-dev/tox/issues/2372: without
# this, tox won't pass through the lower-case proxy environment
# variables set by launchpad-buildd.
@@ -92,7 +92,7 @@ class PyProjectBuildPlugin(BasePlugin):
"""
@hookimpl # type: ignore
- def lpcraft_install_packages(self) -> list[str]:
+ def lpci_install_packages(self) -> list[str]:
# Ubuntu 20.04 does not provide a packaged version of build,
# so we need pip to install it
#
@@ -104,7 +104,7 @@ class PyProjectBuildPlugin(BasePlugin):
]
@hookimpl # type: ignore
- def lpcraft_execute_run(self) -> str:
+ def lpci_execute_run(self) -> str:
# XXX jugmac00 2022-01-20: we should consider using a PPA
return "python3 -m pip install build==0.7.0; python3 -m build"
@@ -180,12 +180,12 @@ class MiniCondaPlugin(BasePlugin):
return conda_channels
@hookimpl # type: ignore
- def lpcraft_set_environment(self) -> dict[str, str]:
+ def lpci_set_environment(self) -> dict[str, str]:
# `CONDA_ENV` sets the name of the Conda virtual environment
return {"CONDA_ENV": "lpci"}
@hookimpl # type: ignore
- def lpcraft_install_packages(self) -> list[str]:
+ def lpci_install_packages(self) -> list[str]:
return [
"git",
"python3-dev",
@@ -195,7 +195,7 @@ class MiniCondaPlugin(BasePlugin):
]
@hookimpl # type: ignore
- def lpcraft_execute_before_run(self) -> str:
+ def lpci_execute_before_run(self) -> str:
run = self.config.run_before or ""
conda_channels = " ".join(f"-c {_}" for _ in self.conda_channels)
return textwrap.dedent(
@@ -213,7 +213,7 @@ class MiniCondaPlugin(BasePlugin):
)
@hookimpl # type: ignore
- def lpcraft_execute_run(self) -> str:
+ def lpci_execute_run(self) -> str:
run = self.config.run or ""
return textwrap.dedent(
f"""
@@ -223,7 +223,7 @@ class MiniCondaPlugin(BasePlugin):
)
@hookimpl # type: ignore
- def lpcraft_execute_after_run(self) -> str:
+ 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; "
@@ -344,27 +344,27 @@ class CondaBuildPlugin(MiniCondaPlugin):
return build_target
@hookimpl # type: ignore
- def lpcraft_set_environment(self) -> dict[str, str]:
+ def lpci_set_environment(self) -> dict[str, str]:
# XXX techalchemy 2022-04-01: mypy is struggling with the super() call
- rv: dict[str, str] = super().lpcraft_set_environment()
+ rv: dict[str, str] = super().lpci_set_environment()
return rv
@hookimpl # type: ignore
- def lpcraft_execute_before_run(self) -> str:
+ def lpci_execute_before_run(self) -> str:
# XXX techalchemy 2022-04-01: mypy is struggling with the super() call
- rv: str = super().lpcraft_execute_before_run()
+ rv: str = super().lpci_execute_before_run()
return rv
@hookimpl # type: ignore
- def lpcraft_execute_after_run(self) -> str:
+ def lpci_execute_after_run(self) -> str:
# XXX techalchemy 2022-04-01: mypy is struggling with the super() call
- rv: str = super().lpcraft_execute_after_run()
+ rv: str = super().lpci_execute_after_run()
return rv
@hookimpl # type: ignore
- def lpcraft_install_packages(self) -> list[str]:
+ def lpci_install_packages(self) -> list[str]:
# XXX techalchemy 2022-04-01: mypy is struggling with the super() call
- base_packages: list[str] = super().lpcraft_install_packages()
+ base_packages: list[str] = super().lpci_install_packages()
base_packages.extend(
[
"automake",
@@ -386,7 +386,7 @@ class CondaBuildPlugin(MiniCondaPlugin):
return base_packages
@hookimpl # type: ignore
- def lpcraft_execute_run(self) -> str:
+ def lpci_execute_run(self) -> str:
conda_channels = " ".join(f"-c {_}" for _ in self.conda_channels)
conda_channels = f" {conda_channels}" if conda_channels else ""
configs = " ".join(f"-m {_}" for _ in self.build_configs)
@@ -438,12 +438,12 @@ class GolangPlugin(BasePlugin):
return cast(GolangPlugin.Config, self.config.plugin_config)
@hookimpl # type: ignore
- def lpcraft_install_packages(self) -> list[str]:
+ def lpci_install_packages(self) -> list[str]:
version = self.get_plugin_config().golang_version
return [f"golang-{version}"]
@hookimpl # type: ignore
- def lpcraft_execute_run(self) -> str:
+ def lpci_execute_run(self) -> str:
version = self.get_plugin_config().golang_version
run_command = self.config.run or ""
return textwrap.dedent(
diff --git a/lpcraft/providers/__init__.py b/lpci/providers/__init__.py
similarity index 81%
rename from lpcraft/providers/__init__.py
rename to lpci/providers/__init__.py
index df1419b..a2df69b 100644
--- a/lpcraft/providers/__init__.py
+++ b/lpci/providers/__init__.py
@@ -6,8 +6,8 @@ __all__ = [
"get_provider",
]
-from lpcraft.providers._base import Provider
-from lpcraft.providers._lxd import LXDProvider
+from lpci.providers._base import Provider
+from lpci.providers._lxd import LXDProvider
def get_provider() -> Provider:
diff --git a/lpcraft/providers/_base.py b/lpci/providers/_base.py
similarity index 96%
rename from lpcraft/providers/_base.py
rename to lpci/providers/_base.py
index 081837c..15d14f7 100644
--- a/lpcraft/providers/_base.py
+++ b/lpci/providers/_base.py
@@ -1,7 +1,7 @@
# Copyright 2021 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
-"""Build environment provider support for lpcraft."""
+"""Build environment provider support for lpci."""
__all__ = [
"Provider",
@@ -31,7 +31,7 @@ def sanitize_lxd_instance_name(name: str) -> str:
class Provider(ABC):
- """A build environment provider for lpcraft."""
+ """A build environment provider for lpci."""
@abstractmethod
def clean_project_environments(
@@ -83,7 +83,7 @@ class Provider(ABC):
:param architecture: Targeted architecture name.
"""
name = (
- f"lpcraft-{project_name}-{project_path.stat().st_ino}"
+ f"lpci-{project_name}-{project_path.stat().st_ino}"
f"-{series}-{architecture}"
)
return sanitize_lxd_instance_name(name)
diff --git a/lpcraft/providers/_buildd.py b/lpci/providers/_buildd.py
similarity index 77%
rename from lpcraft/providers/_buildd.py
rename to lpci/providers/_buildd.py
index bd6b2df..62c5546 100644
--- a/lpcraft/providers/_buildd.py
+++ b/lpci/providers/_buildd.py
@@ -1,10 +1,10 @@
# Copyright 2021 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
-"""Buildd-related code for lpcraft."""
+"""Buildd-related code for lpci."""
__all__ = [
- "LPCraftBuilddBaseConfiguration",
+ "LPCIBuilddBaseConfiguration",
"SERIES_TO_BUILDD_IMAGE_ALIAS",
]
@@ -23,21 +23,21 @@ SERIES_TO_BUILDD_IMAGE_ALIAS = {
}
-class LPCraftBuilddBaseConfiguration(bases.BuilddBase):
- """Base configuration for lpcraft.
+class LPCIBuilddBaseConfiguration(bases.BuilddBase):
+ """Base configuration for lpci.
:cvar compatibility_tag: Tag/version for variant of build configuration
and setup. Any change to this version indicates that prior
(versioned) instances are incompatible and must be cleaned. As
such, any new value should be unique by comparison with old values
- (e.g. incrementing). lpcraft extends the buildd tag to include its
- own version indicator (.0) and namespace ("lpcraft").
+ (e.g. incrementing). lpci extends the buildd tag to include its
+ own version indicator (.0) and namespace ("lpci").
"""
- compatibility_tag: str = f"lpcraft-{bases.BuilddBase.compatibility_tag}.0"
+ compatibility_tag: str = f"lpci-{bases.BuilddBase.compatibility_tag}.0"
def __eq__(self, other: Any) -> bool:
- if not isinstance(other, LPCraftBuilddBaseConfiguration):
+ if not isinstance(other, LPCIBuilddBaseConfiguration):
raise TypeError
return (
self.alias == other.alias
diff --git a/lpcraft/providers/_lxd.py b/lpci/providers/_lxd.py
similarity index 93%
rename from lpcraft/providers/_lxd.py
rename to lpci/providers/_lxd.py
index 565acac..45ef5ff 100644
--- a/lpcraft/providers/_lxd.py
+++ b/lpci/providers/_lxd.py
@@ -1,7 +1,7 @@
# Copyright 2021 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
-"""LXD build environment provider support for lpcraft."""
+"""LXD build environment provider support for lpci."""
__all__ = [
"LXDProvider",
@@ -17,17 +17,17 @@ from craft_cli import emit
from craft_providers import Base, bases, lxd
from pydantic import StrictStr
-from lpcraft.env import (
+from lpci.env import (
get_managed_environment_home_path,
get_managed_environment_project_path,
)
-from lpcraft.errors import CommandError
-from lpcraft.providers._base import Provider, sanitize_lxd_instance_name
-from lpcraft.providers._buildd import (
+from lpci.errors import CommandError
+from lpci.providers._base import Provider, sanitize_lxd_instance_name
+from lpci.providers._buildd import (
SERIES_TO_BUILDD_IMAGE_ALIAS,
- LPCraftBuilddBaseConfiguration,
+ LPCIBuilddBaseConfiguration,
)
-from lpcraft.utils import ask_user
+from lpci.utils import ask_user
_lxc_client = lxd.LXC()
@@ -84,14 +84,14 @@ class _RealLXDInstaller:
class LXDProvider(Provider):
- """A LXD build environment provider for lpcraft.
+ """A LXD build environment provider for lpci.
:param lxc: Optional lxc client to use.
:param lxd_installer: LXD installer to use (default is
craft_providers.lxd).
:param lxd_launcher: LXD launcher to use (default is
craft_providers.lxd.launch).
- :param lxd_project: LXD project to use (default is "lpcraft").
+ :param lxd_project: LXD project to use (default is "lpci").
:param lxd_remote: LXD remote to use (default is "local").
"""
@@ -101,7 +101,7 @@ class LXDProvider(Provider):
lxc: lxd.LXC = _lxc_client,
lxd_installer: _LXDInstaller = _RealLXDInstaller(),
lxd_launcher: _LXDLauncher = lxd.launch,
- lxd_project: str = "lpcraft",
+ lxd_project: str = "lpci",
lxd_remote: str = "local",
) -> None:
self.lxc = lxc
@@ -146,7 +146,7 @@ class LXDProvider(Provider):
project_name = sanitize_lxd_instance_name(project_name)
for instance in instances:
if re.match(
- rf"^lpcraft-{re.escape(project_name)}-{re.escape(inode)}"
+ rf"^lpci-{re.escape(project_name)}-{re.escape(inode)}"
rf"-.+-.+$",
instance,
):
@@ -272,7 +272,7 @@ class LXDProvider(Provider):
# `mock_lxd.get_remote_image` and then assert on `add_remote` being
# called.
image_remote.add_remote(lxc=self.lxc)
- base_configuration = LPCraftBuilddBaseConfiguration(
+ base_configuration = LPCIBuilddBaseConfiguration(
alias=alias, environment=environment, hostname=instance_name
)
diff --git a/lpcraft/providers/tests/__init__.py b/lpci/providers/tests/__init__.py
similarity index 97%
rename from lpcraft/providers/tests/__init__.py
rename to lpci/providers/tests/__init__.py
index bb2254c..eb74bfd 100644
--- a/lpcraft/providers/tests/__init__.py
+++ b/lpci/providers/tests/__init__.py
@@ -7,7 +7,7 @@ from unittest.mock import Mock
from craft_providers.lxd import LXC, LXDError, LXDInstallationError, launch
-from lpcraft.providers._lxd import LXDProvider, _LXDLauncher
+from lpci.providers._lxd import LXDProvider, _LXDLauncher
@dataclass
diff --git a/lpcraft/providers/tests/test_base.py b/lpci/providers/tests/test_base.py
similarity index 92%
rename from lpcraft/providers/tests/test_base.py
rename to lpci/providers/tests/test_base.py
index e96482d..29e16e3 100644
--- a/lpcraft/providers/tests/test_base.py
+++ b/lpci/providers/tests/test_base.py
@@ -3,7 +3,7 @@
import pytest
-from lpcraft.providers._base import sanitize_lxd_instance_name
+from lpci.providers._base import sanitize_lxd_instance_name
@pytest.mark.parametrize(
diff --git a/lpcraft/providers/tests/test_buildd.py b/lpci/providers/tests/test_buildd.py
similarity index 76%
rename from lpcraft/providers/tests/test_buildd.py
rename to lpci/providers/tests/test_buildd.py
index 0aeda3b..ea007ef 100644
--- a/lpcraft/providers/tests/test_buildd.py
+++ b/lpci/providers/tests/test_buildd.py
@@ -5,13 +5,13 @@ import pytest
from craft_providers.bases.buildd import BuilddBaseAlias
from testtools import TestCase
-from lpcraft.providers._buildd import LPCraftBuilddBaseConfiguration
+from lpci.providers._buildd import LPCIBuilddBaseConfiguration
-class TestLPCraftBuilddBaseConfiguration(TestCase):
+class TestLPCIBuilddBaseConfiguration(TestCase):
def test_compare_configuration_with_other_type(self):
"""The configuration should only be comparable to its own type."""
with pytest.raises(TypeError):
- "foo" == LPCraftBuilddBaseConfiguration(
+ "foo" == LPCIBuilddBaseConfiguration(
alias=BuilddBaseAlias.FOCAL,
)
diff --git a/lpcraft/providers/tests/test_get_provider.py b/lpci/providers/tests/test_get_provider.py
similarity index 75%
rename from lpcraft/providers/tests/test_get_provider.py
rename to lpci/providers/tests/test_get_provider.py
index fbf7e88..9ac9734 100644
--- a/lpcraft/providers/tests/test_get_provider.py
+++ b/lpci/providers/tests/test_get_provider.py
@@ -3,8 +3,8 @@
from testtools import TestCase
-from lpcraft.providers import get_provider
-from lpcraft.providers._lxd import LXDProvider
+from lpci.providers import get_provider
+from lpci.providers._lxd import LXDProvider
class TestGetProvider(TestCase):
diff --git a/lpcraft/providers/tests/test_lxd.py b/lpci/providers/tests/test_lxd.py
similarity index 83%
rename from lpcraft/providers/tests/test_lxd.py
rename to lpci/providers/tests/test_lxd.py
index f72fdbf..39a0245 100644
--- a/lpcraft/providers/tests/test_lxd.py
+++ b/lpci/providers/tests/test_lxd.py
@@ -11,10 +11,10 @@ from craft_providers.bases import BaseConfigurationError, BuilddBaseAlias
from craft_providers.lxd import LXC, LXDError, launch
from testtools import TestCase
-from lpcraft.errors import CommandError
-from lpcraft.providers._buildd import LPCraftBuilddBaseConfiguration
-from lpcraft.providers.tests import makeLXDProvider
-from lpcraft.tests.fixtures import RecordingEmitterFixture
+from lpci.errors import CommandError
+from lpci.providers._buildd import LPCIBuilddBaseConfiguration
+from lpci.providers.tests import makeLXDProvider
+from lpci.tests.fixtures import RecordingEmitterFixture
_base_path = (
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
@@ -44,7 +44,7 @@ class TestLXDProvider(TestCase):
def test_clean_project_environments_no_matches(self):
mock_lxc = Mock(spec=LXC)
mock_lxc.list_names.return_value = [
- "lpcraft-testproject-12345-focal-amd64"
+ "lpci-testproject-12345-focal-amd64"
]
provider = makeLXDProvider(lxc=mock_lxc)
@@ -64,19 +64,19 @@ class TestLXDProvider(TestCase):
mock_lxc = Mock(spec=LXC)
mock_lxc.list_names.return_value = [
"do-not-delete-me",
- "lpcraft-testproject-12345-focal-amd64",
- "lpcraft-my-project-12345--",
- "lpcraft-my-project-12345-focal-amd64",
- "lpcraft-my-project-12345-bionic-arm64",
- "lpcraft-my-project-123456--",
- "lpcraft_12345_focal_amd64",
+ "lpci-testproject-12345-focal-amd64",
+ "lpci-my-project-12345--",
+ "lpci-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-bionic-arm64",
+ "lpci-my-project-123456--",
+ "lpci_12345_focal_amd64",
]
provider = makeLXDProvider(lxc=mock_lxc)
self.assertEqual(
[
- "lpcraft-my-project-12345-focal-amd64",
- "lpcraft-my-project-12345-bionic-arm64",
+ "lpci-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-bionic-arm64",
],
provider.clean_project_environments(
project_name="my.project", project_path=self.mock_path
@@ -87,13 +87,13 @@ class TestLXDProvider(TestCase):
[
call.list_names(project="test-project", remote="test-remote"),
call.delete(
- instance_name="lpcraft-my-project-12345-focal-amd64",
+ instance_name="lpci-my-project-12345-focal-amd64",
force=True,
project="test-project",
remote="test-remote",
),
call.delete(
- instance_name="lpcraft-my-project-12345-bionic-arm64",
+ instance_name="lpci-my-project-12345-bionic-arm64",
force=True,
project="test-project",
remote="test-remote",
@@ -106,19 +106,19 @@ class TestLXDProvider(TestCase):
mock_lxc = Mock(spec=LXC)
mock_lxc.list_names.return_value = [
"do-not-delete-me",
- "lpcraft-testproject-12345-focal-amd64",
- "lpcraft-my-project-12345--",
- "lpcraft-my-project-12345-focal-amd64",
- "lpcraft-my-project-12345-bionic-arm64",
- "lpcraft-my-project-123456--",
- "lpcraft_12345_focal_amd64",
+ "lpci-testproject-12345-focal-amd64",
+ "lpci-my-project-12345--",
+ "lpci-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-bionic-arm64",
+ "lpci-my-project-123456--",
+ "lpci_12345_focal_amd64",
]
provider = makeLXDProvider(lxc=mock_lxc)
self.assertEqual(
[
- "lpcraft-my-project-12345-focal-amd64",
- "lpcraft-my-project-12345-bionic-arm64",
+ "lpci-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-bionic-arm64",
],
provider.clean_project_environments(
project_name="my-project", project_path=self.mock_path
@@ -129,13 +129,13 @@ class TestLXDProvider(TestCase):
[
call.list_names(project="test-project", remote="test-remote"),
call.delete(
- instance_name="lpcraft-my-project-12345-focal-amd64",
+ instance_name="lpci-my-project-12345-focal-amd64",
force=True,
project="test-project",
remote="test-remote",
),
call.delete(
- instance_name="lpcraft-my-project-12345-bionic-arm64",
+ instance_name="lpci-my-project-12345-bionic-arm64",
force=True,
project="test-project",
remote="test-remote",
@@ -160,7 +160,7 @@ class TestLXDProvider(TestCase):
def test_clean_project_environments_delete_failure(self):
error = LXDError(brief="Boom")
mock_lxc = Mock(spec=LXC)
- mock_lxc.list_names.return_value = ["lpcraft-test-12345-focal-amd64"]
+ mock_lxc.list_names.return_value = ["lpci-test-12345-focal-amd64"]
mock_lxc.delete.side_effect = error
provider = makeLXDProvider(lxc=mock_lxc)
@@ -176,16 +176,16 @@ class TestLXDProvider(TestCase):
):
mock_lxc = Mock(spec=LXC)
instances = [
- "lpcraft-my-project-12345-focal-amd64",
- "lpcraft-my-project-12345-bionic-arm64",
+ "lpci-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-bionic-arm64",
]
mock_lxc.list_names.return_value = instances
provider = makeLXDProvider(lxc=mock_lxc)
self.assertEqual(
[
- "lpcraft-my-project-12345-focal-amd64",
- "lpcraft-my-project-12345-bionic-arm64",
+ "lpci-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-bionic-arm64",
],
provider.clean_project_environments(
project_name="my-project",
@@ -197,13 +197,13 @@ class TestLXDProvider(TestCase):
[
call.list_names(project="test-project", remote="test-remote"),
call.delete(
- instance_name="lpcraft-my-project-12345-focal-amd64",
+ instance_name="lpci-my-project-12345-focal-amd64",
force=True,
project="test-project",
remote="test-remote",
),
call.delete(
- instance_name="lpcraft-my-project-12345-bionic-arm64",
+ instance_name="lpci-my-project-12345-bionic-arm64",
force=True,
project="test-project",
remote="test-remote",
@@ -217,28 +217,28 @@ class TestLXDProvider(TestCase):
):
mock_lxc = Mock(spec=LXC)
instances = [
- "lpcraft-my-project-12345-focal-amd64",
- "lpcraft-my-project-12345-bionic-arm64",
+ "lpci-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-bionic-arm64",
]
mock_lxc.list_names.return_value = instances
provider = makeLXDProvider(lxc=mock_lxc)
self.assertEqual(
[
- "lpcraft-my-project-12345-bionic-arm64",
+ "lpci-my-project-12345-bionic-arm64",
],
provider.clean_project_environments(
project_name="my-project",
project_path=self.mock_path,
instances=[
- "lpcraft-my-project-12345-bionic-arm64",
+ "lpci-my-project-12345-bionic-arm64",
],
),
)
self.assertEqual(
[
call.delete(
- instance_name="lpcraft-my-project-12345-bionic-arm64",
+ instance_name="lpci-my-project-12345-bionic-arm64",
force=True,
project="test-project",
remote="test-remote",
@@ -253,16 +253,16 @@ class TestLXDProvider(TestCase):
mock_lxc = Mock(spec=LXC)
provider = makeLXDProvider(lxc=mock_lxc)
instances = [
- "lpcraft-my-project-12345-focal-amd64",
- "lpcraft-my-project-12345-bionic-arm64",
+ "lpci-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-bionic-arm64",
"do-not-delete-me",
- "lpcraft-testproject-12345-focal-amd64",
+ "lpci-testproject-12345-focal-amd64",
]
self.assertEqual(
[
- "lpcraft-my-project-12345-focal-amd64",
- "lpcraft-my-project-12345-bionic-arm64",
+ "lpci-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-bionic-arm64",
],
provider.clean_project_environments(
project_name="my-project",
@@ -273,13 +273,13 @@ class TestLXDProvider(TestCase):
self.assertEqual(
[
call.delete(
- instance_name="lpcraft-my-project-12345-focal-amd64",
+ instance_name="lpci-my-project-12345-focal-amd64",
force=True,
project="test-project",
remote="test-remote",
),
call.delete(
- instance_name="lpcraft-my-project-12345-bionic-arm64",
+ instance_name="lpci-my-project-12345-bionic-arm64",
force=True,
project="test-project",
remote="test-remote",
@@ -293,7 +293,7 @@ class TestLXDProvider(TestCase):
provider.ensure_provider_is_available()
- @patch("lpcraft.providers._lxd.ask_user", return_value=False)
+ @patch("lpci.providers._lxd.ask_user", return_value=False)
def test_ensure_provider_is_available_errors_when_user_declines(
self, mock_ask_user
):
@@ -315,7 +315,7 @@ class TestLXDProvider(TestCase):
default=False,
)
- @patch("lpcraft.providers._lxd.ask_user", return_value=True)
+ @patch("lpci.providers._lxd.ask_user", return_value=True)
def test_ensure_provider_is_available_errors_when_lxd_install_fails(
self, mock_ask_user
):
@@ -354,7 +354,7 @@ class TestLXDProvider(TestCase):
provider = makeLXDProvider()
self.assertEqual(
- "lpcraft-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-focal-amd64",
provider.get_instance_name(
project_name="my-project",
project_path=self.mock_path,
@@ -368,7 +368,7 @@ class TestLXDProvider(TestCase):
provider = makeLXDProvider()
self.assertEqual(
- "lpcraft-my-project-12345-focal-amd64",
+ "lpci-my-project-12345-focal-amd64",
provider.get_instance_name(
project_name="my_project",
project_path=self.mock_path,
@@ -412,7 +412,7 @@ class TestLXDProvider(TestCase):
@patch("os.environ", {"PATH": "not-using-host-path"})
def test_launched_environment(self):
- expected_instance_name = "lpcraft-my-project-12345-focal-amd64"
+ expected_instance_name = "lpci-my-project-12345-focal-amd64"
mock_lxc = Mock(spec=LXC)
mock_lxc.profile_show.return_value = {
"config": {"sentinel": "true"},
@@ -450,7 +450,7 @@ class TestLXDProvider(TestCase):
[
call(
name=expected_instance_name,
- base_configuration=LPCraftBuilddBaseConfiguration(
+ base_configuration=LPCIBuilddBaseConfiguration(
alias=BuilddBaseAlias.FOCAL,
environment={"PATH": _base_path},
hostname=expected_instance_name,
@@ -471,7 +471,7 @@ class TestLXDProvider(TestCase):
),
call().lxc.exec(
instance_name=expected_instance_name,
- command=["rm", "-rf", "/build/lpcraft/project"],
+ command=["rm", "-rf", "/build/lpci/project"],
project="test-project",
remote="test-remote",
runner=subprocess.run,
@@ -479,7 +479,7 @@ class TestLXDProvider(TestCase):
),
call().lxc.exec(
instance_name=expected_instance_name,
- command=["mkdir", "-p", "/build/lpcraft"],
+ command=["mkdir", "-p", "/build/lpci"],
project="test-project",
remote="test-remote",
runner=subprocess.run,
@@ -491,7 +491,7 @@ class TestLXDProvider(TestCase):
"cp",
"-a",
"/root/tmp-project",
- "/build/lpcraft/project",
+ "/build/lpci/project",
],
project="test-project",
remote="test-remote",
@@ -508,7 +508,7 @@ class TestLXDProvider(TestCase):
[
call().lxc.exec(
instance_name=expected_instance_name,
- command=["rm", "-rf", "/build/lpcraft/project"],
+ command=["rm", "-rf", "/build/lpci/project"],
project="test-project",
remote="test-remote",
runner=subprocess.run,
@@ -564,7 +564,7 @@ class TestLXDProvider(TestCase):
else:
return subprocess.CompletedProcess([], 0)
- expected_instance_name = "lpcraft-my-project-12345-focal-amd64"
+ expected_instance_name = "lpci-my-project-12345-focal-amd64"
mock_launcher = Mock(spec=launch)
provider = makeLXDProvider(lxd_launcher=mock_launcher)
mock_launcher.return_value.lxc.exec.side_effect = execute
@@ -588,7 +588,7 @@ class TestLXDProvider(TestCase):
),
call().lxc.exec(
instance_name=expected_instance_name,
- command=["rm", "-rf", "/build/lpcraft/project"],
+ command=["rm", "-rf", "/build/lpci/project"],
project="test-project",
remote="test-remote",
runner=subprocess.run,
@@ -596,7 +596,7 @@ class TestLXDProvider(TestCase):
),
call().lxc.exec(
instance_name=expected_instance_name,
- command=["mkdir", "-p", "/build/lpcraft"],
+ command=["mkdir", "-p", "/build/lpci"],
project="test-project",
remote="test-remote",
runner=subprocess.run,
@@ -608,7 +608,7 @@ class TestLXDProvider(TestCase):
"cp",
"-a",
"/root/tmp-project",
- "/build/lpcraft/project",
+ "/build/lpci/project",
],
project="test-project",
remote="test-remote",
@@ -618,7 +618,7 @@ class TestLXDProvider(TestCase):
call().unmount(target=Path("/root/tmp-project")),
call().lxc.exec(
instance_name=expected_instance_name,
- command=["rm", "-rf", "/build/lpcraft/project"],
+ command=["rm", "-rf", "/build/lpci/project"],
project="test-project",
remote="test-remote",
runner=subprocess.run,
@@ -631,7 +631,7 @@ class TestLXDProvider(TestCase):
)
def test_launched_environment_unmounts_and_stops_after_error(self):
- expected_instance_name = "lpcraft-my-project-12345-focal-amd64"
+ expected_instance_name = "lpci-my-project-12345-focal-amd64"
mock_launcher = Mock(spec=launch)
provider = makeLXDProvider(lxd_launcher=mock_launcher)
with self.assertRaisesRegex(RuntimeError, r"Boom"):
@@ -648,7 +648,7 @@ class TestLXDProvider(TestCase):
[
call().lxc.exec(
instance_name=expected_instance_name,
- command=["rm", "-rf", "/build/lpcraft/project"],
+ command=["rm", "-rf", "/build/lpci/project"],
project="test-project",
remote="test-remote",
runner=subprocess.run,
@@ -694,7 +694,7 @@ class TestLXDProvider(TestCase):
self.assertIs(error, raised.exception.__cause__)
- @patch("lpcraft.providers._lxd.lxd")
+ @patch("lpci.providers._lxd.lxd")
def test_launched_environment_configure_buildd_image_remote_lxd_error(
self, mock_lxd
): # noqa: E501
diff --git a/lpcraft/tests/__init__.py b/lpci/tests/__init__.py
similarity index 100%
rename from lpcraft/tests/__init__.py
rename to lpci/tests/__init__.py
diff --git a/lpcraft/tests/fixtures.py b/lpci/tests/fixtures.py
similarity index 100%
rename from lpcraft/tests/fixtures.py
rename to lpci/tests/fixtures.py
diff --git a/lpcraft/tests/test_config.py b/lpci/tests/test_config.py
similarity index 99%
rename from lpcraft/tests/test_config.py
rename to lpci/tests/test_config.py
index a5b875a..7bf45a5 100644
--- a/lpcraft/tests/test_config.py
+++ b/lpci/tests/test_config.py
@@ -16,7 +16,7 @@ from testtools.matchers import (
MatchesStructure,
)
-from lpcraft.config import (
+from lpci.config import (
LAUNCHPAD_PPA_BASE_URL,
Config,
OutputDistributeEnum,
@@ -29,7 +29,7 @@ from lpcraft.config import (
Snap,
get_ppa_url_parts,
)
-from lpcraft.errors import CommandError
+from lpci.errors import CommandError
class TestConfig(TestCase):
diff --git a/lpcraft/tests/test_env.py b/lpci/tests/test_env.py
similarity index 86%
rename from lpcraft/tests/test_env.py
rename to lpci/tests/test_env.py
index 4b73516..58b69f1 100644
--- a/lpcraft/tests/test_env.py
+++ b/lpci/tests/test_env.py
@@ -5,7 +5,7 @@ from pathlib import Path
from testtools import TestCase
-from lpcraft import env
+from lpci import env
class TestEnvironment(TestCase):
@@ -16,6 +16,6 @@ class TestEnvironment(TestCase):
def test_get_managed_environment_project_path(self):
self.assertEqual(
- Path("/build/lpcraft/project"),
+ Path("/build/lpci/project"),
env.get_managed_environment_project_path(),
)
diff --git a/lpcraft/tests/test_errors.py b/lpci/tests/test_errors.py
similarity index 90%
rename from lpcraft/tests/test_errors.py
rename to lpci/tests/test_errors.py
index 4c7f303..457636a 100644
--- a/lpcraft/tests/test_errors.py
+++ b/lpci/tests/test_errors.py
@@ -3,7 +3,7 @@
from unittest import TestCase
-from lpcraft.errors import CommandError
+from lpci.errors import CommandError
class TestError(TestCase):
diff --git a/lpcraft/tests/test_git.py b/lpci/tests/test_git.py
similarity index 98%
rename from lpcraft/tests/test_git.py
rename to lpci/tests/test_git.py
index f2b47e7..0d983c5 100644
--- a/lpcraft/tests/test_git.py
+++ b/lpci/tests/test_git.py
@@ -6,7 +6,7 @@ import io
from systemfixtures import FakeProcesses
from testtools import TestCase
-from lpcraft.git import get_current_branch, get_current_remote_url
+from lpci.git import get_current_branch, get_current_remote_url
class TestGetCurrentBranch(TestCase):
diff --git a/lpcraft/tests/test_main.py b/lpci/tests/test_main.py
similarity index 76%
rename from lpcraft/tests/test_main.py
rename to lpci/tests/test_main.py
index d043637..b67da1e 100644
--- a/lpcraft/tests/test_main.py
+++ b/lpci/tests/test_main.py
@@ -8,29 +8,29 @@ from craft_cli import CraftError, EmitterMode
from fixtures import MockPatch
from testtools import TestCase
-from lpcraft._version import version_description as lpcraft_version
-from lpcraft.main import main
-from lpcraft.tests.fixtures import RecordingEmitterFixture
+from lpci._version import version_description as lpci_version
+from lpci.main import main
+from lpci.tests.fixtures import RecordingEmitterFixture
class TestMain(TestCase):
def test_ok(self):
# main() sets up the message handler and exits cleanly.
- mock_emit = self.useFixture(MockPatch("lpcraft.main.emit")).mock
+ mock_emit = self.useFixture(MockPatch("lpci.main.emit")).mock
ret = main(["--version"])
self.assertEqual(0, ret)
mock_emit.init.assert_called_once_with(
- EmitterMode.BRIEF, "lpcraft", f"Starting {lpcraft_version}"
+ EmitterMode.BRIEF, "lpci", f"Starting {lpci_version}"
)
- mock_emit.message.assert_called_once_with(lpcraft_version)
+ mock_emit.message.assert_called_once_with(lpci_version)
mock_emit.ended_ok.assert_called_once_with()
@patch("sys.stderr", new_callable=io.StringIO)
def test_bad_arguments(self, mock_stderr):
# main() exits appropriately if given bad arguments.
- mock_emit = self.useFixture(MockPatch("lpcraft.main.emit")).mock
+ mock_emit = self.useFixture(MockPatch("lpci.main.emit")).mock
ret = main(["--nonexistent"])
@@ -43,7 +43,7 @@ class TestMain(TestCase):
@patch("sys.stdout", new_callable=io.StringIO)
def test_help(self, mock_stdout):
- mock_emit = self.useFixture(MockPatch("lpcraft.main.emit")).mock
+ mock_emit = self.useFixture(MockPatch("lpci.main.emit")).mock
ret = main(["--help"])
@@ -51,7 +51,7 @@ class TestMain(TestCase):
self.assertIn("Usage:\n", mock_stdout.getvalue())
mock_emit.ended_ok.assert_called_once_with()
- @patch("lpcraft.commands.run.RunCommand.run")
+ @patch("lpci.commands.run.RunCommand.run")
def test_keyboard_interrupt(self, mock_run):
mock_run.side_effect = KeyboardInterrupt()
@@ -64,9 +64,9 @@ class TestMain(TestCase):
emitter.recorder.interactions[-1],
)
- @patch("lpcraft.commands.run.RunCommand.run")
+ @patch("lpci.commands.run.RunCommand.run")
def test_handling_unexpected_exception(self, mock_run):
- self.useFixture(MockPatch("sys.argv", ["lpcraft"]))
+ self.useFixture(MockPatch("sys.argv", ["lpci"]))
mock_run.side_effect = RuntimeError()
with RecordingEmitterFixture() as emitter:
@@ -74,49 +74,47 @@ class TestMain(TestCase):
self.assertEqual(1, ret)
self.assertEqual(
- call(
- "error", CraftError("lpcraft internal error: RuntimeError()")
- ),
+ call("error", CraftError("lpci internal error: RuntimeError()")),
emitter.recorder.interactions[-1],
)
def test_quiet_mode(self):
# temporary test until cli API is set and a more meaningful test is
# possible
- self.useFixture(MockPatch("sys.argv", ["lpcraft", "--version", "-q"]))
+ self.useFixture(MockPatch("sys.argv", ["lpci", "--version", "-q"]))
with RecordingEmitterFixture() as emitter:
main()
- # result is something like "lpcraft, version 0.0.1"
+ # result is something like "lpci, version 0.0.1"
self.assertIn(
- "lpcraft, version", emitter.recorder.interactions[-1].args[1]
+ "lpci, version", emitter.recorder.interactions[-1].args[1]
)
def test_verbose_mode(self):
# temporary test until cli API is set and a more meaningful test is
# possible
- self.useFixture(MockPatch("sys.argv", ["lpcraft", "--version", "-v"]))
+ self.useFixture(MockPatch("sys.argv", ["lpci", "--version", "-v"]))
with RecordingEmitterFixture() as emitter:
main()
- # result is something like "lpcraft, version 0.0.1"
+ # result is something like "lpci, version 0.0.1"
self.assertIn(
- "lpcraft, version", emitter.recorder.interactions[-1].args[1]
+ "lpci, version", emitter.recorder.interactions[-1].args[1]
)
def test_trace_mode(self):
# temporary test until cli API is set and a more meaningful test is
# possible
self.useFixture(
- MockPatch("sys.argv", ["lpcraft", "--version", "--trace"])
+ MockPatch("sys.argv", ["lpci", "--version", "--trace"])
)
with RecordingEmitterFixture() as emitter:
main()
- # result is something like "lpcraft, version 0.0.1"
+ # result is something like "lpci, version 0.0.1"
self.assertIn(
- "lpcraft, version", emitter.recorder.interactions[-1].args[1]
+ "lpci, version", emitter.recorder.interactions[-1].args[1]
)
diff --git a/lpcraft/tests/test_utils.py b/lpci/tests/test_utils.py
similarity index 95%
rename from lpcraft/tests/test_utils.py
rename to lpci/tests/test_utils.py
index 52b42e3..218782e 100644
--- a/lpcraft/tests/test_utils.py
+++ b/lpci/tests/test_utils.py
@@ -10,8 +10,8 @@ from fixtures import TempDir
from systemfixtures import FakeProcesses
from testtools import TestCase
-from lpcraft.errors import ConfigurationError
-from lpcraft.utils import ask_user, get_host_architecture, load_yaml
+from lpci.errors import ConfigurationError
+from lpci.utils import ask_user, get_host_architecture, load_yaml
class TestLoadYAML(TestCase):
@@ -99,7 +99,7 @@ class TestGetHostArchitecture(TestCase):
class TestAskUser(TestCase):
- @patch("lpcraft.utils.input")
+ @patch("lpci.utils.input")
@patch("sys.stdin.isatty")
def test_defaults_with_tty(self, mock_isatty, mock_input):
mock_isatty.return_value = True
@@ -112,7 +112,7 @@ class TestAskUser(TestCase):
self.assertIs(False, ask_user("prompt", default=False))
mock_input.assert_called_once_with("prompt [y/N]: ")
- @patch("lpcraft.utils.input")
+ @patch("lpci.utils.input")
@patch("sys.stdin.isatty")
def test_defaults_without_tty(self, mock_isatty, mock_input):
mock_isatty.return_value = False
@@ -122,7 +122,7 @@ class TestAskUser(TestCase):
mock_input.assert_not_called()
- @patch("lpcraft.utils.input")
+ @patch("lpci.utils.input")
@patch("sys.stdin.isatty")
def test_handles_input(self, mock_isatty, mock_input):
mock_isatty.return_value = True
diff --git a/lpcraft/utils.py b/lpci/utils.py
similarity index 98%
rename from lpcraft/utils.py
rename to lpci/utils.py
index a369cbd..cd17360 100644
--- a/lpcraft/utils.py
+++ b/lpci/utils.py
@@ -15,7 +15,7 @@ from typing import Any, Dict
import yaml
-from lpcraft.errors import ConfigurationError
+from lpci.errors import ConfigurationError
def load_yaml(path: Path) -> Dict[Any, Any]:
diff --git a/setup.cfg b/setup.cfg
index ce85fe5..303da84 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,10 +1,10 @@
[metadata]
-name = lpcraft
+name = lpci
version = 0.1.0.dev0
description = Runner for Launchpad CI jobs
long_description = file: README.rst
long_description_content_type = text/x-rst
-url = https://launchpad.net/lpcraft
+url = https://launchpad.net/lpci
author = Colin Watson
author_email = cjwatson@xxxxxxxxxxxxx
license = GPL-3.0
@@ -35,7 +35,7 @@ python_requires = >=3.8
[options.entry_points]
console_scripts =
- lpcraft = lpcraft.main:main
+ lpci = lpci.main:main
[options.extras_require]
docs =
@@ -52,7 +52,7 @@ test =
wadllib
[isort]
-known_first_party = lpcraft
+known_first_party = lpci
line_length = 79
profile = black
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 291a73c..0c04201 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,21 +1,21 @@
# Copyright 2021 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
-name: lpcraft
+name: lpci
base: core20
summary: Runner for Launchpad CI jobs
license: GPL-3.0
description: |
- lpcraft is a runner for Launchpad CI jobs. You can use it locally, though
+ lpci is a runner for Launchpad CI jobs. You can use it locally, though
most people will use it via Launchpad. Create a `.launchpad.yaml` file
describing the builds and tests you want to run, and Launchpad will run them
for you.
-adopt-info: lpcraft # look for 'snapcraftctl set-*' in the lpcraft part
+adopt-info: lpci # look for 'snapcraftctl set-*' in the lpci part
compression: lzo
apps:
- lpcraft:
- command: bin/python3 $SNAP/bin/lpcraft
+ lpci:
+ command: bin/python3 $SNAP/bin/lpci
environment:
# have the cache outside of the version dirs (avoids keeping N copies)
XDG_CACHE_HOME: $SNAP_USER_COMMON/cache
@@ -50,7 +50,7 @@ parts:
snapcraftctl build
install -D -m 0755 $SNAPCRAFT_PROJECT_DIR/snap/local/sitecustomize.py $SNAPCRAFT_PART_INSTALL/usr/lib/python3.8/sitecustomize.py
- lpcraft:
+ lpci:
after: [python3]
source: .
plugin: python
diff --git a/tox.ini b/tox.ini
index 2aab910..092b500 100644
--- a/tox.ini
+++ b/tox.ini
@@ -55,7 +55,7 @@ deps =
types-PyYAML
types-requests
commands =
- mypy --cache-dir="{envdir}/mypy_cache" --strict {posargs:lpcraft}
+ mypy --cache-dir="{envdir}/mypy_cache" --strict {posargs:lpci}
[testenv:coverage]
description =