From df97424ae0d48d3e653ca4f55b35e2a82f6a1dea Mon Sep 17 00:00:00 2001 From: Aidan McMahon-Smith Date: Tue, 21 May 2024 15:16:28 +0200 Subject: [PATCH 1/2] Use src structure to enable pubtools namespace [RHELDST-17607] --- setup.py | 5 +++-- {pubtools => src/pubtools}/__init__.py | 0 {pubtools => src/pubtools}/_impl/__init__.py | 0 {pubtools => src/pubtools}/_impl/mallopt.py | 0 {pubtools => src/pubtools}/_impl/pluggy.py | 0 {pubtools => src/pubtools}/_impl/tracing.py | 0 {pubtools => src/pubtools}/pluggy.py | 0 {pubtools => src/pubtools}/tracing.py | 0 8 files changed, 3 insertions(+), 2 deletions(-) rename {pubtools => src/pubtools}/__init__.py (100%) rename {pubtools => src/pubtools}/_impl/__init__.py (100%) rename {pubtools => src/pubtools}/_impl/mallopt.py (100%) rename {pubtools => src/pubtools}/_impl/pluggy.py (100%) rename {pubtools => src/pubtools}/_impl/tracing.py (100%) rename {pubtools => src/pubtools}/pluggy.py (100%) rename {pubtools => src/pubtools}/tracing.py (100%) diff --git a/setup.py b/setup.py index 4a205fa..dec067a 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(): @@ -24,7 +24,8 @@ def get_requirements(): setup( name="pubtools", version="1.4.0", - packages=find_packages(exclude=["tests"]), + packages=find_namespace_packages(where="src"), + package_dir={"": "src"}, url="https://github.com/release-engineering/pubtools", license="GNU General Public License", description=get_description(), diff --git a/pubtools/__init__.py b/src/pubtools/__init__.py similarity index 100% rename from pubtools/__init__.py rename to src/pubtools/__init__.py diff --git a/pubtools/_impl/__init__.py b/src/pubtools/_impl/__init__.py similarity index 100% rename from pubtools/_impl/__init__.py rename to src/pubtools/_impl/__init__.py diff --git a/pubtools/_impl/mallopt.py b/src/pubtools/_impl/mallopt.py similarity index 100% rename from pubtools/_impl/mallopt.py rename to src/pubtools/_impl/mallopt.py diff --git a/pubtools/_impl/pluggy.py b/src/pubtools/_impl/pluggy.py similarity index 100% rename from pubtools/_impl/pluggy.py rename to src/pubtools/_impl/pluggy.py diff --git a/pubtools/_impl/tracing.py b/src/pubtools/_impl/tracing.py similarity index 100% rename from pubtools/_impl/tracing.py rename to src/pubtools/_impl/tracing.py diff --git a/pubtools/pluggy.py b/src/pubtools/pluggy.py similarity index 100% rename from pubtools/pluggy.py rename to src/pubtools/pluggy.py diff --git a/pubtools/tracing.py b/src/pubtools/tracing.py similarity index 100% rename from pubtools/tracing.py rename to src/pubtools/tracing.py From aacc1204174029af728cc2e223b28f38dae03281 Mon Sep 17 00:00:00 2001 From: Aidan McMahon-Smith Date: Tue, 21 May 2024 15:16:28 +0200 Subject: [PATCH 2/2] 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. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index ac820da..e3c8c6e 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ whitelist_externals=sh [testenv:cov] usedevelop=true commands= - pytest --cov-report=xml --cov=pubtools {posargs} + pytest --cov-report=xml --cov=src/pubtools {posargs} [testenv:docs] deps=