Skip to content
Snippets Groups Projects
Commit 91158b30 authored by Samuel Burbulla's avatar Samuel Burbulla Committed by Andreas Dedner
Browse files

Store setup.py and pyproject.toml when uploading modules.

make setup-dunepy.py work again without an installed dune-common

remove unused default cmake options for building dune-py

Add git checkout setup.py pyproject.toml to dunepackaging -c.
parent 461f63ed
No related branches found
No related tags found
1 merge request!900Feature/scikit build
......@@ -30,7 +30,6 @@ def main(argv):
print(usage())
sys.exit(2)
sdist = True
upload = False
repository = "gitlab"
clean = False
......@@ -61,14 +60,24 @@ def main(argv):
if clean:
removeFiles()
if not upload:
sys.exit(2)
checkout = ['git', 'checkout', 'setup.py', 'pyproject.toml']
subprocess.call(checkout)
sys.exit(2)
data, cmake_flags = metaData(version, dependencyCheck=False)
if version is None:
version = data.version
# Store current setup.py and pyproject.toml
if upload:
try:
subprocess.call(['cp', 'setup.py', 'setup.py.old'])
subprocess.call(['cp', 'pyproject.toml', 'pyproject.toml.old'])
print("Stored setup.py and pyproject.toml")
except:
pass
# Generate setup.py
print("Generate setup.py")
f = open("setup.py", "w")
......@@ -97,9 +106,9 @@ def main(argv):
f.close()
# Create source distribution
# Create source distribution and upload to repository
python = sys.executable
if sdist:
if upload:
print("Remove dist")
remove = ['rm', '-rf', 'dist']
subprocess.call(remove)
......@@ -115,8 +124,6 @@ def main(argv):
build = [python, 'setup.py', 'sdist']
subprocess.call(build, stdout=subprocess.DEVNULL)
# Upload to repository
if upload:
# check if we have twine
import pkg_resources
installed = {pkg.key for pkg in pkg_resources.working_set}
......@@ -131,6 +138,14 @@ def main(argv):
removeFiles()
# Restore old setup.py and pyproject.toml
try:
print("Restore setup.py and pyproject.toml")
subprocess.call(['mv', 'setup.py.old', 'setup.py'])
subprocess.call(['mv', 'pyproject.toml.old', 'pyproject.toml'])
except:
pass
if __name__ == "__main__":
main(sys.argv[1:])
......@@ -14,9 +14,11 @@ try:
except ImportError:
import os
here = os.path.dirname(os.path.abspath(__file__))
mods = os.path.join(os.path.dirname(here), "python", "dune", "common")
if os.path.exists(os.path.join(mods, "module.py")):
sys.path.append(mods)
modsA = os.path.join(os.path.dirname(here), "python", "dune")
modsB = os.path.join(modsA,"common")
sys.path.append(modsB)
sys.path.append(modsA)
if os.path.exists(os.path.join(modsB, "module.py")):
from module import build_dune_py_module, get_dune_py_dir, make_dune_py_module, select_modules, resolve_dependencies
else:
raise
......
......@@ -15,13 +15,14 @@ from os.path import expanduser
if __name__ == "dune.common.module":
from dune.common.utility import buffer_to_str
from dune.common import project
from dune.packagemetadata import Version, VersionRequirement, Description
else:
from utility import buffer_to_str
import project
from packagemetadata import Version, VersionRequirement, Description
logger = logging.getLogger(__name__)
from dune.packagemetadata import Version, VersionRequirement, Description
def find_modules(path):
"""find DUNE modules in given path
......@@ -127,7 +128,7 @@ def pkg_config(pkg, var=None):
pkgconfig = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
pkgconfig.wait()
if pkgconfig.returncode != 0:
raise KeyError('package ' + pkg + 'not found.')
raise KeyError('package ' + pkg + ' not found.')
return buffer_to_str(pkgconfig.stdout.read()).strip()
......
......@@ -243,13 +243,11 @@ def metaData(version=None, dependencyCheck=True):
data = Data(version)
cmake_flags = [
'-DCMAKE_BUILD_TYPE=Release',
'-DBUILD_SHARED_LIBS=TRUE',
'-DDUNE_ENABLE_PYTHONBINDINGS=TRUE',
'-DDUNE_PYTHON_INSTALL_LOCATION=none',
'-DDUNE_GRID_GRIDTYPE_SELECTOR=ON',
'-DALLOW_CXXFLAGS_OVERWRITE=ON',
'-DUSE_PTHREADS=ON',
'-DCMAKE_BUILD_TYPE=Release',
'-DCMAKE_DISABLE_FIND_PACKAGE_LATEX=TRUE',
'-DCMAKE_DISABLE_DOCUMENTATION=TRUE',
'-DINKSCAPE=FALSE',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment