Skip to content

Commit

Permalink
Use pubtools namespace to resolve init file conflict [RHELDST-17607]
Browse files Browse the repository at this point in the history
Currently, there's an issue with packaging where most of the pubtool-<lib> 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.
  • Loading branch information
amcmahon-rh committed May 30, 2024
1 parent 8bca412 commit 30b1e21
Show file tree
Hide file tree
Showing 53 changed files with 20 additions and 5 deletions.
1 change: 0 additions & 1 deletion pubtools/__init__.py

This file was deleted.

20 changes: 18 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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():
Expand All @@ -22,7 +37,8 @@ def get_requirements():
setup(
name="pubtools-pulplib",
version="2.35.0",
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",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:docs]
deps=
Expand Down

0 comments on commit 30b1e21

Please sign in to comment.