fix namespace packages finding
This commit is contained in:
parent
0d4bcc1d7c
commit
4e861eb2b2
1 changed files with 5 additions and 17 deletions
22
setup.py
22
setup.py
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# see https://github.com/karlicoss/pymplate for up-to-date reference
|
# see https://github.com/karlicoss/pymplate for up-to-date reference
|
||||||
|
|
||||||
from setuptools import setup, find_packages # type: ignore
|
from setuptools import setup, find_namespace_packages # type: ignore
|
||||||
|
|
||||||
INSTALL_REQUIRES = [
|
INSTALL_REQUIRES = [
|
||||||
'appdirs',
|
'appdirs',
|
||||||
|
@ -9,22 +9,9 @@ INSTALL_REQUIRES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def subpackages():
|
|
||||||
# fucking hell. there must be a better way...
|
|
||||||
# TODO FIXME add a test that it install everything I need..
|
|
||||||
from os import sep
|
|
||||||
from pathlib import Path
|
|
||||||
root = Path(__file__).parent
|
|
||||||
sources = root / 'my'
|
|
||||||
subs = [
|
|
||||||
str(p.relative_to(root)).replace(sep, '.')
|
|
||||||
for p in sources.glob('*') if p.is_dir() and len(list(p.rglob('*.py'))) > 0
|
|
||||||
]
|
|
||||||
return list(sorted(subs))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
pkg = 'my'
|
pkg = 'my'
|
||||||
|
subpackages = find_namespace_packages('.', include=('my.*',))
|
||||||
setup(
|
setup(
|
||||||
name='HPI', # NOTE: 'my' is taken for PyPi already, and makes discovering the project impossible. so we're using HPI
|
name='HPI', # NOTE: 'my' is taken for PyPi already, and makes discovering the project impossible. so we're using HPI
|
||||||
use_scm_version={
|
use_scm_version={
|
||||||
|
@ -36,13 +23,14 @@ def main():
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
|
|
||||||
# eh. find_packages doesn't find anything
|
# eh. find_packages doesn't find anything
|
||||||
# find_namespace_packages can't find isngle file namspace packages (like my/common.py)
|
# find_namespace_packages can't find single file packages (like my/common.py)
|
||||||
packages=[pkg, *subpackages()],
|
packages=[pkg, *subpackages],
|
||||||
package_data={
|
package_data={
|
||||||
pkg: [
|
pkg: [
|
||||||
# for mypy
|
# for mypy
|
||||||
'py.typed',
|
'py.typed',
|
||||||
|
|
||||||
|
# TODO hmm maybe not necessary anymore?
|
||||||
# empty dir, necessary for proper dynamic imports
|
# empty dir, necessary for proper dynamic imports
|
||||||
'mycfg_stub/repos/.gitkeep',
|
'mycfg_stub/repos/.gitkeep',
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue