From ec581e7ea4d5acd062f69e4fee7aaacf8edd5c55 Mon Sep 17 00:00:00 2001 From: Aidan McMahon-Smith Date: Tue, 21 May 2024 13:37:14 +0200 Subject: [PATCH] Use pubtools namespace to resolve init file conflict [RHELDST-17607] Currently, there's an issue with packaging where most of the pubtool- projects contains __init__.py and other stuff which is supposed to belong only to pubtools. Python namespaces are a convenient way to work around this issue. --- pubtools/exodus/__init__.py | 1 - setup.py | 5 +++-- {pubtools => src/pubtools/exodus}/__init__.py | 0 {pubtools => src/pubtools}/exodus/_hooks/__init__.py | 0 {pubtools => src/pubtools}/exodus/_hooks/pulp.py | 0 {pubtools => src/pubtools}/exodus/_tasks/__init__.py | 0 {pubtools => src/pubtools}/exodus/_tasks/push.py | 0 {pubtools => src/pubtools}/exodus/gateway.py | 0 {pubtools => src/pubtools}/exodus/task.py | 0 tox.ini | 6 +++--- 10 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 pubtools/exodus/__init__.py rename {pubtools => src/pubtools/exodus}/__init__.py (100%) rename {pubtools => src/pubtools}/exodus/_hooks/__init__.py (100%) rename {pubtools => src/pubtools}/exodus/_hooks/pulp.py (100%) rename {pubtools => src/pubtools}/exodus/_tasks/__init__.py (100%) rename {pubtools => src/pubtools}/exodus/_tasks/push.py (100%) rename {pubtools => src/pubtools}/exodus/gateway.py (100%) rename {pubtools => src/pubtools}/exodus/task.py (100%) diff --git a/pubtools/exodus/__init__.py b/pubtools/exodus/__init__.py deleted file mode 100644 index 8db66d3..0000000 --- a/pubtools/exodus/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/setup.py b/setup.py index 8f1273c..69b1861 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import find_packages, setup +from setuptools import find_namespace_packages, setup def get_description(): @@ -22,7 +22,8 @@ def get_requirements(): setup( name="pubtools-exodus", version="1.5.1", - packages=find_packages(exclude=["tests"]), + packages=find_namespace_packages(where="src"), + package_dir={"": "src"}, include_package_data=True, url="https://github.com/release-engineering/pubtools-exodus", license="GNU General Public License", diff --git a/pubtools/__init__.py b/src/pubtools/exodus/__init__.py similarity index 100% rename from pubtools/__init__.py rename to src/pubtools/exodus/__init__.py diff --git a/pubtools/exodus/_hooks/__init__.py b/src/pubtools/exodus/_hooks/__init__.py similarity index 100% rename from pubtools/exodus/_hooks/__init__.py rename to src/pubtools/exodus/_hooks/__init__.py diff --git a/pubtools/exodus/_hooks/pulp.py b/src/pubtools/exodus/_hooks/pulp.py similarity index 100% rename from pubtools/exodus/_hooks/pulp.py rename to src/pubtools/exodus/_hooks/pulp.py diff --git a/pubtools/exodus/_tasks/__init__.py b/src/pubtools/exodus/_tasks/__init__.py similarity index 100% rename from pubtools/exodus/_tasks/__init__.py rename to src/pubtools/exodus/_tasks/__init__.py diff --git a/pubtools/exodus/_tasks/push.py b/src/pubtools/exodus/_tasks/push.py similarity index 100% rename from pubtools/exodus/_tasks/push.py rename to src/pubtools/exodus/_tasks/push.py diff --git a/pubtools/exodus/gateway.py b/src/pubtools/exodus/gateway.py similarity index 100% rename from pubtools/exodus/gateway.py rename to src/pubtools/exodus/gateway.py diff --git a/pubtools/exodus/task.py b/src/pubtools/exodus/task.py similarity index 100% rename from pubtools/exodus/task.py rename to src/pubtools/exodus/task.py diff --git a/tox.ini b/tox.ini index 55a77db..ebd60f7 100644 --- a/tox.ini +++ b/tox.ini @@ -10,20 +10,20 @@ allowlist_externals=sh [testenv:static] commands= - sh -c 'pylint pubtools; test $(( $? & (1|2|4|32) )) = 0' + sh -c 'pylint src/pubtools/exodus; test $(( $? & (1|2|4|32) )) = 0' black --check . isort --check . [testenv:cov] usedevelop=true commands= - pytest --cov-report=html --cov=pubtools {posargs} + pytest --cov-report=html --cov=pubtools.exodus {posargs} [testenv:cov-ci] passenv=GITHUB_* usedevelop=true commands= - pytest --cov=pubtools {posargs} + pytest --cov=pubtools.exodus {posargs} coveralls --service=github [testenv:docs]