Debian12 again (#1891)

* Use python3 for packaging

* Impovements from fabio

* cython declaration no more needed
This commit is contained in:
Jerome Kieffer 2023-05-31 17:25:02 +02:00 committed by GitHub
parent 44174097f5
commit 3fce90eecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 32 deletions

View File

@ -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)

View File

@ -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)
#

View File

@ -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')

View File

@ -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

View File

@ -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",