From 3db59222801d41448bed241ff449936ed5168376 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/__init__.py | 1 - setup.py | 6 ++++-- {pubtools => src/pubtools}/_ami/__init__.py | 0 {pubtools => src/pubtools}/_ami/arguments.py | 0 {pubtools => src/pubtools}/_ami/rhsm.py | 0 {pubtools => src/pubtools}/_ami/services/__init__.py | 0 {pubtools => src/pubtools}/_ami/services/aws.py | 0 {pubtools => src/pubtools}/_ami/services/base.py | 0 {pubtools => src/pubtools}/_ami/services/collector.py | 0 {pubtools => src/pubtools}/_ami/services/rhsm_.py | 0 {pubtools => src/pubtools}/_ami/step.py | 0 {pubtools => src/pubtools}/_ami/task.py | 0 {pubtools => src/pubtools}/_ami/tasks/__init__.py | 0 {pubtools => src/pubtools}/_ami/tasks/base.py | 0 {pubtools => src/pubtools}/_ami/tasks/delete.py | 0 {pubtools => src/pubtools}/_ami/tasks/exceptions.py | 0 {pubtools => src/pubtools}/_ami/tasks/push.py | 0 tox.ini | 4 ++-- 18 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 pubtools/__init__.py rename {pubtools => src/pubtools}/_ami/__init__.py (100%) rename {pubtools => src/pubtools}/_ami/arguments.py (100%) rename {pubtools => src/pubtools}/_ami/rhsm.py (100%) rename {pubtools => src/pubtools}/_ami/services/__init__.py (100%) rename {pubtools => src/pubtools}/_ami/services/aws.py (100%) rename {pubtools => src/pubtools}/_ami/services/base.py (100%) rename {pubtools => src/pubtools}/_ami/services/collector.py (100%) rename {pubtools => src/pubtools}/_ami/services/rhsm_.py (100%) rename {pubtools => src/pubtools}/_ami/step.py (100%) rename {pubtools => src/pubtools}/_ami/task.py (100%) rename {pubtools => src/pubtools}/_ami/tasks/__init__.py (100%) rename {pubtools => src/pubtools}/_ami/tasks/base.py (100%) rename {pubtools => src/pubtools}/_ami/tasks/delete.py (100%) rename {pubtools => src/pubtools}/_ami/tasks/exceptions.py (100%) rename {pubtools => src/pubtools}/_ami/tasks/push.py (100%) diff --git a/pubtools/__init__.py b/pubtools/__init__.py deleted file mode 100644 index 7097d96..0000000 --- a/pubtools/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # pragma: no cover diff --git a/setup.py b/setup.py index be2c0be..67571c1 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import setup, find_packages +from setuptools import setup, find_namespace_packages def get_description(): @@ -22,7 +22,9 @@ def get_requirements(): setup( name="pubtools-ami", version="2.3.1", - packages=find_packages(exclude=["tests"]), + + packages=find_namespace_packages(where="src"), + package_dir={"": "src"}, url="https://github.com/release-engineering/pubtools-ami", license="GNU General Public License", description=get_description(), diff --git a/pubtools/_ami/__init__.py b/src/pubtools/_ami/__init__.py similarity index 100% rename from pubtools/_ami/__init__.py rename to src/pubtools/_ami/__init__.py diff --git a/pubtools/_ami/arguments.py b/src/pubtools/_ami/arguments.py similarity index 100% rename from pubtools/_ami/arguments.py rename to src/pubtools/_ami/arguments.py diff --git a/pubtools/_ami/rhsm.py b/src/pubtools/_ami/rhsm.py similarity index 100% rename from pubtools/_ami/rhsm.py rename to src/pubtools/_ami/rhsm.py diff --git a/pubtools/_ami/services/__init__.py b/src/pubtools/_ami/services/__init__.py similarity index 100% rename from pubtools/_ami/services/__init__.py rename to src/pubtools/_ami/services/__init__.py diff --git a/pubtools/_ami/services/aws.py b/src/pubtools/_ami/services/aws.py similarity index 100% rename from pubtools/_ami/services/aws.py rename to src/pubtools/_ami/services/aws.py diff --git a/pubtools/_ami/services/base.py b/src/pubtools/_ami/services/base.py similarity index 100% rename from pubtools/_ami/services/base.py rename to src/pubtools/_ami/services/base.py diff --git a/pubtools/_ami/services/collector.py b/src/pubtools/_ami/services/collector.py similarity index 100% rename from pubtools/_ami/services/collector.py rename to src/pubtools/_ami/services/collector.py diff --git a/pubtools/_ami/services/rhsm_.py b/src/pubtools/_ami/services/rhsm_.py similarity index 100% rename from pubtools/_ami/services/rhsm_.py rename to src/pubtools/_ami/services/rhsm_.py diff --git a/pubtools/_ami/step.py b/src/pubtools/_ami/step.py similarity index 100% rename from pubtools/_ami/step.py rename to src/pubtools/_ami/step.py diff --git a/pubtools/_ami/task.py b/src/pubtools/_ami/task.py similarity index 100% rename from pubtools/_ami/task.py rename to src/pubtools/_ami/task.py diff --git a/pubtools/_ami/tasks/__init__.py b/src/pubtools/_ami/tasks/__init__.py similarity index 100% rename from pubtools/_ami/tasks/__init__.py rename to src/pubtools/_ami/tasks/__init__.py diff --git a/pubtools/_ami/tasks/base.py b/src/pubtools/_ami/tasks/base.py similarity index 100% rename from pubtools/_ami/tasks/base.py rename to src/pubtools/_ami/tasks/base.py diff --git a/pubtools/_ami/tasks/delete.py b/src/pubtools/_ami/tasks/delete.py similarity index 100% rename from pubtools/_ami/tasks/delete.py rename to src/pubtools/_ami/tasks/delete.py diff --git a/pubtools/_ami/tasks/exceptions.py b/src/pubtools/_ami/tasks/exceptions.py similarity index 100% rename from pubtools/_ami/tasks/exceptions.py rename to src/pubtools/_ami/tasks/exceptions.py diff --git a/pubtools/_ami/tasks/push.py b/src/pubtools/_ami/tasks/push.py similarity index 100% rename from pubtools/_ami/tasks/push.py rename to src/pubtools/_ami/tasks/push.py diff --git a/tox.ini b/tox.ini index 8eb1def..c69ea80 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,7 @@ allowlist_externals=sh [testenv:static] commands= - sh -c 'pylint pubtools; test $(( $? & (1|2|4|32) )) = 0' + sh -c 'pylint src/pubtools; test $(( $? & (1|2|4|32) )) = 0' [testenv:pidiff] skip_install=true @@ -17,7 +17,7 @@ commands=pidiff pubtools-ami . [testenv:cov] usedevelop=true commands= - pytest --cov-report=html --cov-report=xml --cov=pubtools {posargs} + pytest --cov-report=html --cov-report=xml --cov=src/pubtools {posargs} [testenv:docs] use_develop=true