diff --git a/docs/Makefile b/docs/Makefile index 298ea9e2..a3d0678b 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SOURCEDIR = . +SOURCEDIR = BUILDDIR = _build # Put it first so that "make" without argument is like "make help". diff --git a/docs/schema.rst b/docs/schema.rst index d38af3c7..4f7ca4f6 100644 --- a/docs/schema.rst +++ b/docs/schema.rst @@ -17,28 +17,28 @@ reference. Repository ---------- -.. include:: ../pubtools/pulplib/_impl/schema/repository.yaml +.. include:: ../src/pubtools/pulplib/_impl/schema/repository.yaml :code: yaml Task ---- -.. include:: ../pubtools/pulplib/_impl/schema/task.yaml +.. include:: ../src/pubtools/pulplib/_impl/schema/task.yaml :code: yaml Unit ---- -.. include:: ../pubtools/pulplib/_impl/schema/unit.yaml +.. include:: ../src/pubtools/pulplib/_impl/schema/unit.yaml :code: yaml Maintenance ----------- -.. include:: ../pubtools/pulplib/_impl/schema/maintenance.yaml +.. include:: ../src/pubtools/pulplib/_impl/schema/maintenance.yaml :code: yaml .. _JSON schema: https://json-schema.org/ diff --git a/pubtools/__init__.py b/pubtools/__init__.py deleted file mode 100644 index 8db66d3d..00000000 --- a/pubtools/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/setup.py b/setup.py index 8e6456c5..e094508c 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,19 @@ -from setuptools import setup, find_packages +from setuptools import setup + +try: + from setuptools import find_namespace_packages +except ImportError: + # Workaround for RHEL-8 RPM packaging that uses setuptools 39.2 + # find_namespace_packages is supported since setuptools 40.1 + # Loosely backported from https://github.com/pypa/setuptools/blob/main/setuptools/discovery.py + from setuptools import PackageFinder + + class PEP420PackageFinder(PackageFinder): + @staticmethod + def _looks_like_package(_path): + return True + + find_namespace_packages = PEP420PackageFinder.find def get_description(): @@ -22,7 +37,8 @@ def get_requirements(): setup( name="pubtools-pulplib", version="2.39.1", - packages=find_packages(exclude=["tests"]), + packages=find_namespace_packages(where="src"), + package_dir={"": "src"}, package_data={"pubtools.pulplib._impl.schema": ["*.yaml"]}, url="https://github.com/release-engineering/pubtools-pulplib", license="GNU General Public License", diff --git a/pubtools/pulplib/__init__.py b/src/pubtools/pulplib/__init__.py similarity index 100% rename from pubtools/pulplib/__init__.py rename to src/pubtools/pulplib/__init__.py diff --git a/pubtools/pulplib/_impl/__init__.py b/src/pubtools/pulplib/_impl/__init__.py similarity index 100% rename from pubtools/pulplib/_impl/__init__.py rename to src/pubtools/pulplib/_impl/__init__.py diff --git a/pubtools/pulplib/_impl/client/__init__.py b/src/pubtools/pulplib/_impl/client/__init__.py similarity index 100% rename from pubtools/pulplib/_impl/client/__init__.py rename to src/pubtools/pulplib/_impl/client/__init__.py diff --git a/pubtools/pulplib/_impl/client/client.py b/src/pubtools/pulplib/_impl/client/client.py similarity index 100% rename from pubtools/pulplib/_impl/client/client.py rename to src/pubtools/pulplib/_impl/client/client.py diff --git a/pubtools/pulplib/_impl/client/copy.py b/src/pubtools/pulplib/_impl/client/copy.py similarity index 100% rename from pubtools/pulplib/_impl/client/copy.py rename to src/pubtools/pulplib/_impl/client/copy.py diff --git a/pubtools/pulplib/_impl/client/errors.py b/src/pubtools/pulplib/_impl/client/errors.py similarity index 100% rename from pubtools/pulplib/_impl/client/errors.py rename to src/pubtools/pulplib/_impl/client/errors.py diff --git a/pubtools/pulplib/_impl/client/poller.py b/src/pubtools/pulplib/_impl/client/poller.py similarity index 100% rename from pubtools/pulplib/_impl/client/poller.py rename to src/pubtools/pulplib/_impl/client/poller.py diff --git a/pubtools/pulplib/_impl/client/retry.py b/src/pubtools/pulplib/_impl/client/retry.py similarity index 100% rename from pubtools/pulplib/_impl/client/retry.py rename to src/pubtools/pulplib/_impl/client/retry.py diff --git a/pubtools/pulplib/_impl/client/search.py b/src/pubtools/pulplib/_impl/client/search.py similarity index 100% rename from pubtools/pulplib/_impl/client/search.py rename to src/pubtools/pulplib/_impl/client/search.py diff --git a/pubtools/pulplib/_impl/client/ud_mappings.py b/src/pubtools/pulplib/_impl/client/ud_mappings.py similarity index 100% rename from pubtools/pulplib/_impl/client/ud_mappings.py rename to src/pubtools/pulplib/_impl/client/ud_mappings.py diff --git a/pubtools/pulplib/_impl/compat_attr.py b/src/pubtools/pulplib/_impl/compat_attr.py similarity index 100% rename from pubtools/pulplib/_impl/compat_attr.py rename to src/pubtools/pulplib/_impl/compat_attr.py diff --git a/pubtools/pulplib/_impl/comps.py b/src/pubtools/pulplib/_impl/comps.py similarity index 100% rename from pubtools/pulplib/_impl/comps.py rename to src/pubtools/pulplib/_impl/comps.py diff --git a/pubtools/pulplib/_impl/criteria.py b/src/pubtools/pulplib/_impl/criteria.py similarity index 100% rename from pubtools/pulplib/_impl/criteria.py rename to src/pubtools/pulplib/_impl/criteria.py diff --git a/pubtools/pulplib/_impl/fake/__init__.py b/src/pubtools/pulplib/_impl/fake/__init__.py similarity index 100% rename from pubtools/pulplib/_impl/fake/__init__.py rename to src/pubtools/pulplib/_impl/fake/__init__.py diff --git a/pubtools/pulplib/_impl/fake/client.py b/src/pubtools/pulplib/_impl/fake/client.py similarity index 100% rename from pubtools/pulplib/_impl/fake/client.py rename to src/pubtools/pulplib/_impl/fake/client.py diff --git a/pubtools/pulplib/_impl/fake/controller.py b/src/pubtools/pulplib/_impl/fake/controller.py similarity index 100% rename from pubtools/pulplib/_impl/fake/controller.py rename to src/pubtools/pulplib/_impl/fake/controller.py diff --git a/pubtools/pulplib/_impl/fake/match.py b/src/pubtools/pulplib/_impl/fake/match.py similarity index 100% rename from pubtools/pulplib/_impl/fake/match.py rename to src/pubtools/pulplib/_impl/fake/match.py diff --git a/pubtools/pulplib/_impl/fake/rpmlib.py b/src/pubtools/pulplib/_impl/fake/rpmlib.py similarity index 100% rename from pubtools/pulplib/_impl/fake/rpmlib.py rename to src/pubtools/pulplib/_impl/fake/rpmlib.py diff --git a/pubtools/pulplib/_impl/fake/state.py b/src/pubtools/pulplib/_impl/fake/state.py similarity index 100% rename from pubtools/pulplib/_impl/fake/state.py rename to src/pubtools/pulplib/_impl/fake/state.py diff --git a/pubtools/pulplib/_impl/fake/units.py b/src/pubtools/pulplib/_impl/fake/units.py similarity index 100% rename from pubtools/pulplib/_impl/fake/units.py rename to src/pubtools/pulplib/_impl/fake/units.py diff --git a/pubtools/pulplib/_impl/hooks.py b/src/pubtools/pulplib/_impl/hooks.py similarity index 100% rename from pubtools/pulplib/_impl/hooks.py rename to src/pubtools/pulplib/_impl/hooks.py diff --git a/pubtools/pulplib/_impl/log.py b/src/pubtools/pulplib/_impl/log.py similarity index 100% rename from pubtools/pulplib/_impl/log.py rename to src/pubtools/pulplib/_impl/log.py diff --git a/pubtools/pulplib/_impl/model/__init__.py b/src/pubtools/pulplib/_impl/model/__init__.py similarity index 100% rename from pubtools/pulplib/_impl/model/__init__.py rename to src/pubtools/pulplib/_impl/model/__init__.py diff --git a/pubtools/pulplib/_impl/model/attr.py b/src/pubtools/pulplib/_impl/model/attr.py similarity index 100% rename from pubtools/pulplib/_impl/model/attr.py rename to src/pubtools/pulplib/_impl/model/attr.py diff --git a/pubtools/pulplib/_impl/model/common.py b/src/pubtools/pulplib/_impl/model/common.py similarity index 100% rename from pubtools/pulplib/_impl/model/common.py rename to src/pubtools/pulplib/_impl/model/common.py diff --git a/pubtools/pulplib/_impl/model/convert.py b/src/pubtools/pulplib/_impl/model/convert.py similarity index 100% rename from pubtools/pulplib/_impl/model/convert.py rename to src/pubtools/pulplib/_impl/model/convert.py diff --git a/pubtools/pulplib/_impl/model/distributor.py b/src/pubtools/pulplib/_impl/model/distributor.py similarity index 100% rename from pubtools/pulplib/_impl/model/distributor.py rename to src/pubtools/pulplib/_impl/model/distributor.py diff --git a/pubtools/pulplib/_impl/model/maintenance.py b/src/pubtools/pulplib/_impl/model/maintenance.py similarity index 100% rename from pubtools/pulplib/_impl/model/maintenance.py rename to src/pubtools/pulplib/_impl/model/maintenance.py diff --git a/pubtools/pulplib/_impl/model/repository/__init__.py b/src/pubtools/pulplib/_impl/model/repository/__init__.py similarity index 100% rename from pubtools/pulplib/_impl/model/repository/__init__.py rename to src/pubtools/pulplib/_impl/model/repository/__init__.py diff --git a/pubtools/pulplib/_impl/model/repository/base.py b/src/pubtools/pulplib/_impl/model/repository/base.py similarity index 100% rename from pubtools/pulplib/_impl/model/repository/base.py rename to src/pubtools/pulplib/_impl/model/repository/base.py diff --git a/pubtools/pulplib/_impl/model/repository/container.py b/src/pubtools/pulplib/_impl/model/repository/container.py similarity index 100% rename from pubtools/pulplib/_impl/model/repository/container.py rename to src/pubtools/pulplib/_impl/model/repository/container.py diff --git a/pubtools/pulplib/_impl/model/repository/file.py b/src/pubtools/pulplib/_impl/model/repository/file.py similarity index 100% rename from pubtools/pulplib/_impl/model/repository/file.py rename to src/pubtools/pulplib/_impl/model/repository/file.py diff --git a/pubtools/pulplib/_impl/model/repository/repo_lock.py b/src/pubtools/pulplib/_impl/model/repository/repo_lock.py similarity index 100% rename from pubtools/pulplib/_impl/model/repository/repo_lock.py rename to src/pubtools/pulplib/_impl/model/repository/repo_lock.py diff --git a/pubtools/pulplib/_impl/model/repository/yum.py b/src/pubtools/pulplib/_impl/model/repository/yum.py similarity index 100% rename from pubtools/pulplib/_impl/model/repository/yum.py rename to src/pubtools/pulplib/_impl/model/repository/yum.py diff --git a/pubtools/pulplib/_impl/model/task.py b/src/pubtools/pulplib/_impl/model/task.py similarity index 100% rename from pubtools/pulplib/_impl/model/task.py rename to src/pubtools/pulplib/_impl/model/task.py diff --git a/pubtools/pulplib/_impl/model/unit/__init__.py b/src/pubtools/pulplib/_impl/model/unit/__init__.py similarity index 100% rename from pubtools/pulplib/_impl/model/unit/__init__.py rename to src/pubtools/pulplib/_impl/model/unit/__init__.py diff --git a/pubtools/pulplib/_impl/model/unit/base.py b/src/pubtools/pulplib/_impl/model/unit/base.py similarity index 100% rename from pubtools/pulplib/_impl/model/unit/base.py rename to src/pubtools/pulplib/_impl/model/unit/base.py diff --git a/pubtools/pulplib/_impl/model/unit/erratum.py b/src/pubtools/pulplib/_impl/model/unit/erratum.py similarity index 100% rename from pubtools/pulplib/_impl/model/unit/erratum.py rename to src/pubtools/pulplib/_impl/model/unit/erratum.py diff --git a/pubtools/pulplib/_impl/model/unit/file.py b/src/pubtools/pulplib/_impl/model/unit/file.py similarity index 100% rename from pubtools/pulplib/_impl/model/unit/file.py rename to src/pubtools/pulplib/_impl/model/unit/file.py diff --git a/pubtools/pulplib/_impl/model/unit/modulemd.py b/src/pubtools/pulplib/_impl/model/unit/modulemd.py similarity index 100% rename from pubtools/pulplib/_impl/model/unit/modulemd.py rename to src/pubtools/pulplib/_impl/model/unit/modulemd.py diff --git a/pubtools/pulplib/_impl/model/unit/modulemd_defaults.py b/src/pubtools/pulplib/_impl/model/unit/modulemd_defaults.py similarity index 100% rename from pubtools/pulplib/_impl/model/unit/modulemd_defaults.py rename to src/pubtools/pulplib/_impl/model/unit/modulemd_defaults.py diff --git a/pubtools/pulplib/_impl/model/unit/repo_metadata.py b/src/pubtools/pulplib/_impl/model/unit/repo_metadata.py similarity index 100% rename from pubtools/pulplib/_impl/model/unit/repo_metadata.py rename to src/pubtools/pulplib/_impl/model/unit/repo_metadata.py diff --git a/pubtools/pulplib/_impl/model/unit/rpm.py b/src/pubtools/pulplib/_impl/model/unit/rpm.py similarity index 100% rename from pubtools/pulplib/_impl/model/unit/rpm.py rename to src/pubtools/pulplib/_impl/model/unit/rpm.py diff --git a/pubtools/pulplib/_impl/model/validate.py b/src/pubtools/pulplib/_impl/model/validate.py similarity index 100% rename from pubtools/pulplib/_impl/model/validate.py rename to src/pubtools/pulplib/_impl/model/validate.py diff --git a/pubtools/pulplib/_impl/page.py b/src/pubtools/pulplib/_impl/page.py similarity index 100% rename from pubtools/pulplib/_impl/page.py rename to src/pubtools/pulplib/_impl/page.py diff --git a/pubtools/pulplib/_impl/schema/__init__.py b/src/pubtools/pulplib/_impl/schema/__init__.py similarity index 100% rename from pubtools/pulplib/_impl/schema/__init__.py rename to src/pubtools/pulplib/_impl/schema/__init__.py diff --git a/pubtools/pulplib/_impl/schema/maintenance.yaml b/src/pubtools/pulplib/_impl/schema/maintenance.yaml similarity index 100% rename from pubtools/pulplib/_impl/schema/maintenance.yaml rename to src/pubtools/pulplib/_impl/schema/maintenance.yaml diff --git a/pubtools/pulplib/_impl/schema/repository.yaml b/src/pubtools/pulplib/_impl/schema/repository.yaml similarity index 100% rename from pubtools/pulplib/_impl/schema/repository.yaml rename to src/pubtools/pulplib/_impl/schema/repository.yaml diff --git a/pubtools/pulplib/_impl/schema/task.yaml b/src/pubtools/pulplib/_impl/schema/task.yaml similarity index 100% rename from pubtools/pulplib/_impl/schema/task.yaml rename to src/pubtools/pulplib/_impl/schema/task.yaml diff --git a/pubtools/pulplib/_impl/schema/unit.yaml b/src/pubtools/pulplib/_impl/schema/unit.yaml similarity index 100% rename from pubtools/pulplib/_impl/schema/unit.yaml rename to src/pubtools/pulplib/_impl/schema/unit.yaml diff --git a/pubtools/pulplib/_impl/util.py b/src/pubtools/pulplib/_impl/util.py similarity index 100% rename from pubtools/pulplib/_impl/util.py rename to src/pubtools/pulplib/_impl/util.py diff --git a/tox.ini b/tox.ini index ab9e503c..d765bcdb 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ deps= pylint==2.7.2 commands= black --check . - sh -c 'pylint pubtools; test $(( $? & (1|2|4|32) )) = 0' + sh -c 'pylint src/pubtools/pulplib; test $(( $? & (1|2|4|32) )) = 0' [testenv:pidiff] deps=pidiff @@ -27,7 +27,7 @@ deps= pytest-timeout usedevelop=true commands= - pytest -svv --timeout 60 --cov-report=html --cov-report=xml --cov=pubtools --cov-fail-under=100 {posargs} + pytest -svv --timeout 60 --cov-report=html --cov-report=xml --cov=pubtools.pulplib --cov-fail-under=100 {posargs} [testenv:lock] deps=