Skip to content

Commit

Permalink
Debian12 again (silx-kit#1891)
Browse files Browse the repository at this point in the history
* Use python3 for packaging

* Impovements from fabio

* cython declaration no more needed
  • Loading branch information
kif authored May 31, 2023
1 parent 4417409 commit 3fce90e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 32 deletions.
28 changes: 14 additions & 14 deletions bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand All @@ -194,7 +195,6 @@ def find_executable(target):
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:
Expand All @@ -213,9 +213,9 @@ def find_executable(target):
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)
Expand Down
2 changes: 1 addition & 1 deletion build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ([email protected])
#
Expand Down
14 changes: 0 additions & 14 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
1 change: 0 additions & 1 deletion package/debian12/control
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions version.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -47,7 +47,7 @@
__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",
Expand Down

0 comments on commit 3fce90e

Please sign in to comment.