From 3fce90eecf12a497c3e1513505b093c0b65c4e16 Mon Sep 17 00:00:00 2001 From: Jerome Kieffer Date: Wed, 31 May 2023 17:25:02 +0200 Subject: [PATCH] Debian12 again (#1891) * Use python3 for packaging * Impovements from fabio * cython declaration no more needed --- bootstrap.py | 28 ++++++++++++++-------------- build-deb.sh | 2 +- meson.build | 14 -------------- package/debian12/control | 1 - version.py | 4 ++-- 5 files changed, 17 insertions(+), 32 deletions(-) diff --git a/bootstrap.py b/bootstrap.py index 5cc4a692..bba68780 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -33,7 +33,7 @@ def get_project_name(root_dir): logger.debug("Getting project name in %s", root_dir) with open("pyproject.toml") as f: pyproject = tomli.loads(f.read()) - return pyproject.get("project",{}).get("name") + return pyproject.get("project", {}).get("name") def build_project(name, root_dir): @@ -61,19 +61,20 @@ def build_project(name, root_dir): shell=False, cwd=build, env=os.environ) logger.debug("meson install ended with rc= %s", p.wait()) - + home = None if os.environ.get("PYBUILD_NAME") == name: # we are in the debian packaging way home = os.environ.get("PYTHONPATH", "").split(os.pathsep)[-1] - elif os.environ.get("BUILDPYTHONPATH"): - home = os.path.abspath(os.environ.get("BUILDPYTHONPATH", "")) - else: - if sys.platform == "win32": - home = os.path.join(build, libdir, "site-packages") + if not home: + if os.environ.get("BUILDPYTHONPATH"): + home = os.path.abspath(os.environ.get("BUILDPYTHONPATH", "")) else: - python_version = f"python{sys.version_info.major}.{sys.version_info.minor}" - home = os.path.join(build, libdir, python_version, "site-packages") - home = os.path.abspath(home) + if sys.platform == "win32": + home = os.path.join(build, libdir, "site-packages") + else: + python_version = f"python{sys.version_info.major}.{sys.version_info.minor}" + home = os.path.join(build, libdir, python_version, "site-packages") + home = os.path.abspath(home) cnt = 0 while not os.path.isdir(home): @@ -183,7 +184,7 @@ def find_executable(target): # search the executable in pyproject.toml with open(os.path.join(PROJECT_DIR, "pyproject.toml")) as f: pyproject = tomli.loads(f.read()) - for script, entry_point in list(pyproject.get("console_scripts",{}).items())+list(pyproject.get("gui_scripts",{}).items()): + for script, entry_point in list(pyproject.get("console_scripts", {}).items()) + list(pyproject.get("gui_scripts", {}).items()): if script == target: print(script, entry_point) return ("entry_point", target, entry_point) @@ -194,7 +195,6 @@ PROJECT_DIR = os.path.dirname(os.path.abspath(__file__)) PROJECT_NAME = get_project_name(PROJECT_DIR) logger.info("Project name: %s", PROJECT_NAME) - if __name__ == "__main__": LIBPATH = build_project(PROJECT_NAME, PROJECT_DIR) if len(sys.argv) < 2: @@ -213,9 +213,9 @@ if __name__ == "__main__": if script: argv = sys.argv[2:] res = find_executable(script) - if res[0] == "path": + if res[0] == "path": run_file(res[1], argv) - elif res[0] == "entry_point": + elif res[0] == "entry_point": run_entry_point(res[1], res[2], argv) else: logger.error("Script %s not found", script) diff --git a/build-deb.sh b/build-deb.sh index c92fde6e..f3575079 100755 --- a/build-deb.sh +++ b/build-deb.sh @@ -3,7 +3,7 @@ # Project: PyFAI Input/Output # https://github.com/silx-kit/pyFAI # -# Copyright (C) 2015-2019 European Synchrotron Radiation Facility, Grenoble, France +# Copyright (C) 2015-2023 European Synchrotron Radiation Facility, Grenoble, France # # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu) # diff --git a/meson.build b/meson.build index d251e6d0..8036b8fa 100644 --- a/meson.build +++ b/meson.build @@ -13,13 +13,7 @@ if meson.backend() != 'ninja' error('Ninja backend required') endif -# Seek for Cython installation -cython = find_program('cython3', 'cython', required : true) -if not cython.found() - error('Cython not found.') -endif cc = meson.get_compiler('c') - m_dep = cc.find_library('m', required : false) if m_dep.found() add_project_link_arguments('-lm', language : 'c') @@ -30,12 +24,4 @@ py_mod = import('python') py = py_mod.find_installation() py_dep = py.dependency() -# MinGW-W64 # -#if host_machine.system() == 'windows' and meson.get_compiler('c').get_id() == 'gcc' -# add_project_link_arguments('-lucrt', '-static', language: 'c') -# add_project_arguments('-mlong-double-64', language: 'c') -# add_project_arguments('-DMS_WIN64', language: 'c') -#endif - - subdir('pyFAI') diff --git a/package/debian12/control b/package/debian12/control index 70a5605b..36a168fb 100644 --- a/package/debian12/control +++ b/package/debian12/control @@ -24,7 +24,6 @@ Build-Depends: cython3 (>=0.29.31), python3-nbconvert, python3-nbsphinx, python3-sphinx-rtd-theme, - python-dev-is-python3, help2man, devscripts Standards-Version: 3.9.6 diff --git a/version.py b/version.py index ad7ea19d..ef87b13f 100644 --- a/version.py +++ b/version.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding: utf-8 # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -47,7 +47,7 @@ Thus 2.1.0a3 is hexversion 0x020100a3. __authors__ = ["Jérôme Kieffer", "V. Valls"] __license__ = "MIT" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" -__date__ = "16/05/2023" +__date__ = "31/05/2023" __status__ = "production" __docformat__ = 'restructuredtext' __all__ = ["date", "version_info", "strictversion", "hexversion", "debianversion",