From 3d752bf11fcf09916fcdea7791323300f3f8e72f Mon Sep 17 00:00:00 2001 From: Jerome Kieffer Date: Wed, 29 Nov 2023 10:24:02 +0100 Subject: [PATCH] Include doc --- build-deb.sh | 56 ++++++++++++----- build-doc.py | 23 +++++++ doc/source/conf.py | 1 + e2etest/e2etest_bift.py | 4 +- e2etest/e2etest_cormap.py | 4 +- e2etest/e2etest_freesas.py | 4 +- e2etest/e2etest_guinier_apps.py | 4 +- package/debian12/changelog | 5 ++ package/debian12/clean | 1 + package/debian12/compat | 1 + package/debian12/control | 66 ++++++++++++++++++++ package/debian12/gbp.conf | 2 + package/debian12/python-freesas-doc.doc-base | 9 +++ package/debian12/rules | 46 ++++++++++++++ package/debian12/source/format | 1 + package/debian12/source/options | 1 + package/debian12/watch | 5 ++ 17 files changed, 208 insertions(+), 25 deletions(-) create mode 100755 build-doc.py create mode 100644 package/debian12/changelog create mode 100644 package/debian12/clean create mode 100644 package/debian12/compat create mode 100644 package/debian12/control create mode 100644 package/debian12/gbp.conf create mode 100644 package/debian12/python-freesas-doc.doc-base create mode 100644 package/debian12/rules create mode 100644 package/debian12/source/format create mode 100644 package/debian12/source/options create mode 100644 package/debian12/watch diff --git a/build-deb.sh b/build-deb.sh index 274431a..f51c9ba 100755 --- a/build-deb.sh +++ b/build-deb.sh @@ -3,7 +3,7 @@ # Project: FreeSaS # https://github.com/kif/freesas # -# Copyright (C) 2015-2020 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) # @@ -56,12 +56,15 @@ then stretch) debian_version=9 ;; - buster) + buster) debian_version=10 ;; bullseye) debian_version=11 ;; + bookworm) + debian_version=12 + ;; esac fi @@ -78,21 +81,25 @@ build_directory=${project_directory}/build/${target_system} if [ -d /usr/lib/ccache ]; then export PATH=/usr/lib/ccache:$PATH + export CCACHE_DIR=${HOME}/.ccache fi usage="usage: $(basename "$0") [options] + Build the Debian ${debian_version} package of the ${project} library. + If the build succeed the directory dist/debian${debian_version} will contains the packages. + optional arguments: --help Show this help text --install Install the packages generated at the end of the process using 'sudo dpkg' --stdeb-py3 Build using stdeb for python3 - --stdeb-py2.py3 Build using stdeb for python2 and python3 --debian9 Simulate a debian 9 Stretch system --debian10 Simulate a debian 10 Buster system --debian11 Simulate a debian 11 Bullseye system + --debian12 Simulate a debian 12 Bookworm system " install=0 @@ -141,6 +148,13 @@ do build_directory=${project_directory}/build/${target_system} shift ;; + --debian12) + debian_version=12 + target_system=debian${debian_version} + dist_directory=${project_directory}/dist/${target_system} + build_directory=${project_directory}/build/${target_system} + shift + ;; -*) echo "Error: Unknown option: $1" >&2 echo "$usage" @@ -164,20 +178,27 @@ clean_up() build_deb() { tarname=${project}_${debianversion}.orig.tar.gz clean_up - python3 setup.py debian_src - python3 setup.py testdata + if [ $debian_version -le 11 ] + then + python3 setup.py debian_src + directory=${project}-${strictversion} + else + python3 -m build -s + ln -s ${source_project}-${strictversion}.tar.gz dist/${tarname} + directory=${source_project}-${strictversion} + fi cp -f dist/${tarname} ${build_directory} if [ -f dist/${project}-testimages.tar.gz ] then cp -f dist/${project}-testimages.tar.gz ${build_directory} fi - + cd ${build_directory} tar -xzf ${tarname} - - directory=${project}-${strictversion} + + newname=${deb_name}_${debianversion}.orig.tar.gz - + #echo tarname $tarname newname $newname if [ $tarname != $newname ] then @@ -187,7 +208,7 @@ build_deb() { fi ln -s ${tarname} ${newname} fi - + if [ -f ${project}-testimages.tar.gz ] then if [ ! -h ${deb_name}_${debianversion}.orig-testimages.tar.gz ] @@ -195,11 +216,11 @@ build_deb() { ln -s ${project}-testimages.tar.gz ${deb_name}_${debianversion}.orig-testimages.tar.gz fi fi - + cd ${directory} cp -r ${project_directory}/package/${target_system} debian cp ${project_directory}/copyright debian - + #handle test images if [ -f ../${deb_name}_${debianversion}.orig-testimages.tar.gz ] then @@ -208,7 +229,7 @@ build_deb() { mkdir testimages fi cd testimages - tar -xzf ../../${deb_name}_${debianversion}.orig-testimages.tar.gz + tar -xzf ../${deb_name}_${debianversion}.orig-testimages.tar.gz cd .. else # Disable to skip tests during build @@ -230,12 +251,12 @@ build_deb() { ;; esac - dch --force-distribution -v ${debianversion}-1 "upstream development build of ${project} ${version}" + dch --force-distribution -v ${debianversion}-1 "upstream development build of ${project} ${version}" dch --force-distribution -D ${debian_name}-backports -l~bpo${debian_version}+ "${project} snapshot ${version} built for ${target_system}" #dch --bpo "${project} snapshot ${version} built for ${target_system}" dpkg-buildpackage -r rc=$? - + if [ $rc -eq 0 ]; then # move packages to dist directory echo Build succeeded... @@ -264,7 +285,8 @@ build_stdeb () { tar -xzf ${tarname} cd ${project}-${strictversion} - if [ $stdeb_all_python -eq 1 ]; then + if [ $stdeb_all_python -eq 1 ] + then echo Using Python 2+3 python3 setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True --with-python3=True --no-python3-scripts=True build --no-cython bdist_deb rc=$? @@ -293,7 +315,7 @@ fi if [ $install -eq 1 ]; then - sudo -- su -c "dpkg -i ${dist_directory}/*.deb" + sudo su -c "dpkg -i ${dist_directory}/*.deb" fi exit "$rc" diff --git a/build-doc.py b/build-doc.py new file mode 100755 index 0000000..c1e1a66 --- /dev/null +++ b/build-doc.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +import os +import sys +import logging +import bootstrap +from sphinx.cmd.build import main +logger = logging.getLogger(__name__) +PROJECT_DIR = os.path.dirname(os.path.abspath(__file__)) +PROJECT_NAME = bootstrap.get_project_name(PROJECT_DIR) +logger.info("Project name: %s", PROJECT_NAME) +LIBPATH = bootstrap.build_project(PROJECT_NAME, PROJECT_DIR) +if __name__ == '__main__': + sys.path.insert(0, LIBPATH) + os.environ["PYTHONPATH"]=os.pathsep.join(sys.path) + print(os.environ["PYTHONPATH"]) + dest_dir = os.path.join(PROJECT_DIR, "build", "sphinx") + if not os.path.isdir(dest_dir): + os.makedirs(dest_dir) + argv = ["-b", "html", + os.path.join(PROJECT_DIR,"doc","source"), + dest_dir ] + print(f"run sphinx with those arguments {argv}") + sys.exit(main(argv)) diff --git a/doc/source/conf.py b/doc/source/conf.py index 7edcce1..909da52 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -102,6 +102,7 @@ 'sphinx.ext.viewcode', 'sphinx.ext.doctest', # 'sphinxext-archive', + 'sphinxcontrib.programoutput', 'nbsphinx' ] diff --git a/e2etest/e2etest_bift.py b/e2etest/e2etest_bift.py index 3addf24..ec077d9 100644 --- a/e2etest/e2etest_bift.py +++ b/e2etest/e2etest_bift.py @@ -2,7 +2,7 @@ __authors__ = ["Martha Brennich"] __license__ = "MIT" -__date__ = "16/07/2021" +__date__ = "29/11/2023" import unittest import pathlib @@ -14,7 +14,7 @@ import codecs import parse from numpy import loadtxt -from freesas.test.utilstests import get_datafile +from freesas.test.utilstest import get_datafile logger = logging.getLogger(__name__) diff --git a/e2etest/e2etest_cormap.py b/e2etest/e2etest_cormap.py index c5abc77..758317e 100644 --- a/e2etest/e2etest_cormap.py +++ b/e2etest/e2etest_cormap.py @@ -2,7 +2,7 @@ __authors__ = ["Martha Brennich"] __license__ = "MIT" -__date__ = "02/04/2022" +__date__ = "29/11/2023" import unittest import pathlib @@ -11,7 +11,7 @@ from subprocess import run, PIPE, STDOUT from os import linesep from os.path import normpath -from freesas.test.utilstests import get_datafile +from freesas.test.utilstest import get_datafile logger = logging.getLogger(__name__) diff --git a/e2etest/e2etest_freesas.py b/e2etest/e2etest_freesas.py index 19ff14b..2de4059 100644 --- a/e2etest/e2etest_freesas.py +++ b/e2etest/e2etest_freesas.py @@ -25,7 +25,7 @@ __authors__ = ["Martha Brennich"] __license__ = "MIT" -__date__ = "16/07/2021" +__date__ = "29/11/2023" import unittest import pathlib @@ -34,7 +34,7 @@ from subprocess import run, Popen, PIPE, STDOUT from os import linesep import PyPDF2 -from freesas.test.utilstests import get_datafile +from freesas.test.utilstest import get_datafile logger = logging.getLogger(__name__) diff --git a/e2etest/e2etest_guinier_apps.py b/e2etest/e2etest_guinier_apps.py index d07f3f5..3a0893b 100644 --- a/e2etest/e2etest_guinier_apps.py +++ b/e2etest/e2etest_guinier_apps.py @@ -2,7 +2,7 @@ __authors__ = ["Martha Brennich"] __license__ = "MIT" -__date__ = "16/07/2021" +__date__ = "29/11/2023" import unittest import pathlib @@ -11,7 +11,7 @@ from os import linesep from os.path import normpath from platform import system -from freesas.test.utilstests import get_datafile +from freesas.test.utilstest import get_datafile logger = logging.getLogger(__name__) diff --git a/package/debian12/changelog b/package/debian12/changelog new file mode 100644 index 0000000..9c0d0d7 --- /dev/null +++ b/package/debian12/changelog @@ -0,0 +1,5 @@ +freesas (0.7.0-1) unstable; urgency=low + + * Initial release (Closes: #??????) + + -- Jerome Kieffer Fri, 31 Aug 2017 11:00:20 +0100 diff --git a/package/debian12/clean b/package/debian12/clean new file mode 100644 index 0000000..668a363 --- /dev/null +++ b/package/debian12/clean @@ -0,0 +1 @@ +*.egg-info/* \ No newline at end of file diff --git a/package/debian12/compat b/package/debian12/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/package/debian12/compat @@ -0,0 +1 @@ +10 diff --git a/package/debian12/control b/package/debian12/control new file mode 100644 index 0000000..b33853d --- /dev/null +++ b/package/debian12/control @@ -0,0 +1,66 @@ +Source: freesas +Maintainer: Debian Science Maintainers +Uploaders: Jerome Kieffer , + Picca Frédéric-Emmanuel +Section: science +Priority: extra +Build-Depends: cython3, + debhelper (>=9.20150101+deb8u2), + python3-all-dev, + python3-setuptools, + python3-numpy, + python3-matplotlib, + python3-scipy, + python3-sphinx, + python3-sphinxcontrib.programoutput, + python3-nbsphinx, + python3-silx, + python3-pyfai, + openstack-pkg-tools, + help2man, + dh-python, + python3-sphinx-rtd-theme +Standards-Version: 3.9.8 +Vcs-Browser: https://anonscm.debian.org/cgit/debian-science/packages/freesas.git +Vcs-Git: git://anonscm.debian.org/debian-science/packages/freesas.git +Homepage: https://github.com/kif/freesas +X-Python3-Version: >= 3.6 + +Package: freesas +Architecture: all +Depends: ${misc:Depends}, + ${python:Depends}, + ${shlibs:Depends}, + python3-pkg-resources, + python3-freesas (>= ${source:Version}) +Description: Free tools for small angle scattering analysis - Executables + . + This uses the Python 3 version of the package. + + +Package: python3-freesas +Architecture: any +Section: python +Depends: ${misc:Depends}, + ${python3:Depends}, + ${shlibs:Depends}, + python3-numpy, + python3-matplotlib, + python3-scipy, + python3-six, + python3-pyfai +# Recommends: +# Suggests: python3-rfoo +Description: Free tools for small angle scattering analysis - Python3 + . + This is the Python 3 version of the package. + + +Package: python-freesas-doc +Architecture: all +Section: doc +Depends: ${misc:Depends}, + ${sphinxdoc:Depends} +Description: Free tools for small angle scattering analysis - Documentation + . + This is the common documentation package. diff --git a/package/debian12/gbp.conf b/package/debian12/gbp.conf new file mode 100644 index 0000000..f68d262 --- /dev/null +++ b/package/debian12/gbp.conf @@ -0,0 +1,2 @@ +[DEFAULT] +debian-branch = master \ No newline at end of file diff --git a/package/debian12/python-freesas-doc.doc-base b/package/debian12/python-freesas-doc.doc-base new file mode 100644 index 0000000..b77cb80 --- /dev/null +++ b/package/debian12/python-freesas-doc.doc-base @@ -0,0 +1,9 @@ +Document: freesas-manual +Title: freesas documentation manual +Author: Jérôme Kieffer +Abstract: Toolbox for X-Ray data analysis +Section: Science/Data Analysis + +Format: HTML +Index: /usr/share/doc/python-freesas-doc/html/index.html +Files: /usr/share/doc/python-freesas-doc/html/* diff --git a/package/debian12/rules b/package/debian12/rules new file mode 100644 index 0000000..c5aa406 --- /dev/null +++ b/package/debian12/rules @@ -0,0 +1,46 @@ +#!/usr/bin/make -f + +export PYBUILD_NAME=freesas + +# Make does not offer a recursive wildcard function, so here's one: +rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)) + +# How to recursively find all files with the same name in a given folder +ALL_PYX := $(call rwildcard,freesas/,*.pyx) +#NOTA: No space before * + +%: + dh $@ --with python3,sphinxdoc --buildsystem=pybuild + +override_dh_clean: + dh_clean + # remove the cython generated file to force rebuild + rm -f $(patsubst %.pyx,%.cpp,${ALL_PYX}) + rm -f $(patsubst %.pyx,%.c,${ALL_PYX}) + rm -f $(patsubst %.pyx,%.html,${ALL_PYX}) + rm -rf build/html + rm -rf build/man + rm -rf *.egg-info + +override_dh_auto_build: + dh_auto_build + python3 setup.py build build_man build_doc +override_dh_install: + dh_numpy3 + + # move the scripts to right package + dh_install -p freesas debian/python3-freesas/usr/bin/* usr/bin + rm -rf debian/python3-freesas/usr/bin + dh_install + +override_dh_auto_test: + dh_auto_test -- -s custom --test-args="env PYTHONPATH={build_dir} FREESAS_TESTDATA=testimages WITH_QT_TEST=False {interpreter} run_tests.py -v" + +override_dh_installman: + dh_installman -p freesas build/man/*.1 + +override_dh_sphinxdoc: + python3 setup.py build build_man build_doc + dh_installdocs "build/sphinx/html" -p python-freesas-doc --doc-main-package=python3-freesas + dh_sphinxdoc -O--buildsystem=pybuild + diff --git a/package/debian12/source/format b/package/debian12/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/package/debian12/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/package/debian12/source/options b/package/debian12/source/options new file mode 100644 index 0000000..6e88e49 --- /dev/null +++ b/package/debian12/source/options @@ -0,0 +1 @@ +extend-diff-ignore="^[^/]+\.egg-info/" \ No newline at end of file diff --git a/package/debian12/watch b/package/debian12/watch new file mode 100644 index 0000000..8f43589 --- /dev/null +++ b/package/debian12/watch @@ -0,0 +1,5 @@ +version=3 +opts=repacksuffix=+dfsg,\ +uversionmangle=s/(rc|a|b|c)/~$1/,\ +dversionmangle=s/\+dfsg// \ +http://pypi.debian.net/freesas/freesas-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))