Skip to content
Snippets Groups Projects
Commit 79359e69 authored by Andreas Dedner's avatar Andreas Dedner
Browse files

pep 42: use implicit namespace packages which make it possible to combine...

pep 42: use implicit namespace packages which make it possible to combine subpackages using editable (source) and non editable (pypi)
parent d01b38db
Branches
Tags
1 merge request!960refactor the way python is used in dune
......@@ -3,7 +3,6 @@ add_subdirectory(generator)
add_subdirectory(typeregistry)
add_python_targets(dune
__init__
__main__
create
packagemetadata
......
__import__('pkg_resources').declare_namespace(__name__)
#!/usr/bin/env python3
from setuptools import find_packages
from setuptools import find_namespace_packages
import sys, os, io, getopt, re, ast
import shlex
import importlib, subprocess
......@@ -253,15 +253,18 @@ def cmakeArguments(cmakeArgs):
def cmakeFlags():
# defaults
flags = cmakeArguments(dict([
flags = dict([
('CMAKE_BUILD_TYPE','Release'),
('CMAKE_INSTALL_RPATH_USE_LINK_PATH','TRUE'),
('DUNE_ENABLE_PYTHONBINDINGS','TRUE'),
('ALLOW_CXXFLAGS_OVERWRITE','ON'),
('CMAKE_DISABLE_FIND_PACKAGE_LATEX','TRUE'),
('CMAKE_DISABLE_FIND_PACKAGE_Doxygen','TRUE'),
('INKSCAPE','FALSE')
]))
('INKSCAPE','FALSE'),
])
# if inVEnv():
# flags['DUNE_PYTHON_VIRTUALENV_PATH'] = sys.prefix
flags = cmakeArguments(flags) # make cmake command line out of dict
# test environment for additional flags
cmakeFlags = os.environ.get('DUNE_CMAKE_FLAGS')
# split cmakeFlags and add them to flags
......@@ -367,7 +370,7 @@ def metaData(version=None, dependencyCheck=True):
}
if os.path.isdir('python'):
setupParams.update({
"packages":find_packages(where="python"),
"packages":find_namespace_packages(where="python"),
"package_dir":{"": "python"},
"install_requires":install_requires,
"python_requires":'>=3.4',
......
from setuptools import setup, find_packages
from setuptools import setup, find_namespace_packages
pkg = [m for m in "${ProjectPythonRequires}".split(' ') if "dune" not in m]
setup(name="${ProjectName}",
namespace_packages=['dune'],
packages=find_namespace_packages(include=['dune.*']),
description="${ProjectDescription}",
version="${ProjectVersionString}",
author="${ProjectAuthor}",
author_email="${ProjectMaintainerEmail}",
packages = find_packages(),
zip_safe = 0,
package_data = {'': ['*.so']},
install_requires = pkg,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment