diff --git a/debian/compat b/debian/compat index ec63514..b4de394 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -9 +11 diff --git a/debian/control b/debian/control index 15e9e06..2d4f82c 100644 --- a/debian/control +++ b/debian/control @@ -1,29 +1,35 @@ Source: secop-core -Section: misc +Section: contrib/misc Priority: optional Maintainer: Enrico Faulhaber -Build-Depends: debhelper (>= 9.0.0), +Build-Depends: debhelper (>= 11~), dh-python, - git, - python3, + python3 (>=3.6), + python3-all, python3-setuptools, + python3-docutils, + python3-sphinx, python3-sip-dev, python3-pyqt5, - python3-mlzlog | python-mlzlog, + python3-mlzlog, python3-numpy, python3-psutil (>= 0.4), python3-pytest, + python3-serial, + git, markdown, python3-daemon -Standards-Version: 4.3.0 +Standards-Version: 4.1.4 +X-Python3-Version: >= 3.6 Package: secop-core Architecture: all -Depends: python (>= 3.6), +Depends: python3 (>= 3.6), ${misc:Depends}, ${python3:Depends}, python3-setuptools, python3-numpy, + python3-serial, python3-psutil (>= 0.4), python3-mlzlog, markdown, @@ -32,6 +38,14 @@ Description: Frappy SECoP core system contains the core server and client libraries and the server binary as well as the systemd integration +#Package: secop-doc +#Architecture: all +#Section: doc +#Depends: ${sphinxdoc:Depends}, +# ${misc:Depends} +#Description: Frappy SECoP docu +# This is the documentation to all the secop-* packages + Package: secop-gui Architecture: all Depends: secop-core, @@ -46,18 +60,18 @@ Architecture: all Depends: secop-core, ${misc:Depends}, ${python3:Depends} +Recommends: secop-gui Description: SECoP demo files for demonstration purposes -Recommends: secop-gui Package: secop-ess Architecture: all Depends: secop-core, ${misc:Depends}, ${python3:Depends} -Description: SECoP ess files - Modules specific for ESS (http://esss.se) Recommends: secop-gui +Description: SECoP ess files + Modules specific for ESS Package: secop-mlz Architecture: all @@ -65,15 +79,15 @@ Depends: secop-core, ${misc:Depends}, ${python3:Depends}, python-pytango (>=9) -Description: SECoP mlz files - Modules specific for MLZ (http://mlz-garching.de) Recommends: secop-gui +Description: SECoP mlz files + Modules specific for MLZ Package: secop-psi Architecture: all Depends: secop-core, ${misc:Depends}, ${python3:Depends} -Description: SECoP psi files - Modules specific for PSI (http://psi.ch) Recommends: secop-gui +Description: SECoP psi files + Modules specific for PSI diff --git a/debian/copyright b/debian/copyright index 3e93f3f..8162ec1 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,6 +1,8 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: frappy Source: http://forge.frm2.tum.de/cgit/cgit.cgi/frm2/sine2020/secop/playground.git +Comment: FRAPPY is an implementation of the free SECoP protocol + see https://www.github.com/SampleEnvironment/SECoP Files: * Copyright: 2016-2019 by the FRAPPY-SECOP contributors (see AUTHORS) diff --git a/debian/rules b/debian/rules index b6ff8dc..f5a393e 100755 --- a/debian/rules +++ b/debian/rules @@ -9,25 +9,30 @@ DEBPYTHON_SUPPORTED=3.6 export DEBPYTHON_DEFAULT DEBPYTHON_SUPPORTED +export PYBUILD_NAME = secop +export PYBUILD_TEST_PYTEST = 1 + override_dh_install: - @find debian/tmp -name '*.pyc' -exec rm \{\} \; - @find debian/tmp -type d -name '__pycache__' | xargs rmdir + @find debian -name '*.pyc' -exec rm \{\} \; + @find debian -type d -name '__pycache__' | xargs rmdir + + cp -aR debian/python3-secop/* debian/tmp + mv debian/tmp/usr/lib/python3.? debian/tmp/usr/lib/python3 @echo "regen debian/secop-core.install" @echo "usr/bin/secop-server" > debian/secop-core.install @echo "usr/bin/secop-console" >> debian/secop-core.install - @echo "etc/init.d/secop-server" >> debian/secop-core.install @(cd debian/tmp; find . -name '*.py'| grep -v gui|grep /secop/; \ - find . | grep egg-info; \ - find . | grep RELEASE-VERSION; \ - find ./lib; \ - find ./var ) | \ - while read f;do echo $${f#./};done | cat >> debian/secop-core.install + find . -type f| grep egg-info; \ + find . -type f| grep RELEASE-VERSION; \ + find ./lib -type f; \ + find ./var -type f) | \ + while read f;do echo $${f#./}; done | cat >> debian/secop-core.install @echo "regen debian/secop-gui.install" @echo "usr/bin/secop-gui" > debian/secop-gui.install @echo "usr/bin/secop-cfg-editor" >> debian/secop-gui.install - @(cd debian/tmp; find . |grep gui|grep /secop/) | \ + @(cd debian/tmp; find . -type f|grep gui|grep /secop/) | \ while read f;do echo $${f#./};done | cat >> debian/secop-gui.install @for facility in demo ess mlz psi;do \ diff --git a/debian/secop-core.install b/debian/secop-core.install index 6b62aa0..acb1751 100644 --- a/debian/secop-core.install +++ b/debian/secop-core.install @@ -1,6 +1,5 @@ usr/bin/secop-server usr/bin/secop-console -etc/init.d/secop-server usr/lib/python3.7/dist-packages/secop/errors.py usr/lib/python3.7/dist-packages/secop/modules.py usr/lib/python3.7/dist-packages/secop/features.py diff --git a/etc/secop-server b/etc/secop-server deleted file mode 100755 index 9c020d0..0000000 --- a/etc/secop-server +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -### BEGIN INIT INFO -# Provides: secop-server -# Required-Start: $local_fs $remote_fs $network $named $time -# Required-Stop: $local_fs $remote_fs $network -# Should-Start: tangowait -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Description: Secop servers -### END INIT INFO -# ***************************************************************************** -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Module authors: -# Alexander Lenz -# -# ***************************************************************************** - -import sys -import argparse -import os.path -import glob -import signal - - -CFG_DIR = '/etc/secop' -PID_DIR = '/var/run/secop' -SRV_EXEC = 'secop-server' - -inplace_basedir = os.path.join(os.path.dirname(__file__), '..') -if os.path.isfile(os.path.join(inplace_basedir, 'src', '__init__.py')): - CFG_DIR = os.path.join(inplace_basedir, 'etc') - PID_DIR = os.path.join(inplace_basedir, 'pid') - SRV_EXEC = os.path.join(inplace_basedir, 'bin/secop-server') - - -def parseArgv(argv): - parser = argparse.ArgumentParser(description='Manage a SECoP server') - parser.add_argument('action', - type=str, - choices=['start', 'stop', 'restart', 'status'], - help='What to do with the desired server', ) - parser.add_argument('name', - nargs='*', - help='Name of the instance.\n' - ' Uses etc/name.cfg for configuration\n',) - return parser.parse_args() - - -def getServerNames(): - return sorted([os.path.basename(entry)[:-4] - for entry in glob.glob(os.path.join(CFG_DIR, '*.cfg'))]) - - -def getSrvPid(name): - pidfile = os.path.join(PID_DIR, '%s.pid' % name) - if not os.path.isfile(pidfile): - return None - with open(pidfile) as f: - return int(f.read()) - - -def startServer(name): - pid = getSrvPid(name) - - if pid: - print('%s: already running (pid: %s)' % (name, pid)) - else: - print('%s: starting ...' % name) - os.system('%s -d %s' % (SRV_EXEC, name)) - - -def stopServer(name): - pid = getSrvPid(name) - if pid: - print('%s: stopping ...' % name) - os.kill(pid, signal.SIGTERM) - else: - print('%s: already stopped' % name) - - -def determineServerStatus(name): - pid = getSrvPid(name) - - if pid: - print('%s: running (pid: %s)' % (name, pid)) - else: - print('%s: dead' % name) - - -def main(argv=None): - if argv is None: - argv = sys.argv - - args = parseArgv(argv[1:]) - - actionMap = { - 'start': startServer, - 'stop': stopServer, - 'status': determineServerStatus, - } - - srvs = args.name - if not srvs: - srvs = getServerNames() - - for entry in srvs: - actionMap[args.action](entry) - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/etc/secop@.service b/etc/secop@.service index 64e7518..d7e93a4 100644 --- a/etc/secop@.service +++ b/etc/secop@.service @@ -1,6 +1,7 @@ [Unit] Description=SECoP SEC-node: %i After=network-online.service +Documentation= [Service] Type=notify diff --git a/secop/version.py b/secop/version.py index edee704..afcbd78 100644 --- a/secop/version.py +++ b/secop/version.py @@ -37,11 +37,13 @@ GIT_REPO = os.path.join(os.path.dirname(__file__), '..', '.git') def get_git_version(abbrev=4, cwd=None): try: + print("REPO:", GIT_REPO) p = Popen(['git', '--git-dir=%s' % GIT_REPO, 'describe', '--abbrev=%d' % abbrev], stdout=PIPE, stderr=PIPE) stdout, _stderr = p.communicate() version = stdout.strip().decode('utf-8', 'ignore') + print("git:", version) # mangle version to comply with pep440 if version.count('-'): version, patchcount, githash = version.split('-') diff --git a/setup.py b/setup.py index 0bf3530..2f60237 100644 --- a/setup.py +++ b/setup.py @@ -45,12 +45,10 @@ setup( packages=find_packages(exclude=['test']), package_data={'secop': ['RELEASE-VERSION'] + uis}, data_files=[ - ('/etc/init.d', ['etc/secop-server']), ('/lib/systemd/system-generators', ['etc/secop-generator']), ('/lib/systemd/system', ['etc/secop@.service', 'etc/secop.target']), ('/var/log/secop', []), - ('/var/run/secop', []), ], scripts=scripts, classifiers=[ @@ -61,8 +59,6 @@ setup( 'License :: OSI Approved :: GPL License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Topic :: Scientific/Engineering',