processview 0.3.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/__pycache__/__init__.cpython-38.pyc +0 -0
  2. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/__pycache__/setup.cpython-38.pyc +0 -0
  3. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/__pycache__/version.cpython-38.pyc +0 -0
  4. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/__pycache__/__init__.cpython-38.pyc +0 -0
  5. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/__pycache__/dataset.cpython-38.pyc +0 -0
  6. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/__pycache__/helpers.cpython-38.pyc +0 -0
  7. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/__pycache__/setup.cpython-38.pyc +0 -0
  8. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/__pycache__/superviseprocess.cpython-38.pyc +0 -0
  9. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/manager/__pycache__/__init__.cpython-38.pyc +0 -0
  10. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/manager/__pycache__/manager.cpython-38.pyc +0 -0
  11. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/manager/manager.py +5 -0
  12. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/manager/test/__pycache__/__init__.cpython-38.pyc +0 -0
  13. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/manager/test/__pycache__/test_manager.cpython-38.pyc +0 -0
  14. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/core/test/__pycache__/__init__.cpython-38.pyc +0 -0
  15. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/gui/__pycache__/__init__.cpython-38.pyc +0 -0
  16. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/gui/__pycache__/icons.cpython-38.pyc +0 -0
  17. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/gui/__pycache__/messagebox.cpython-38.pyc +0 -0
  18. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/gui/__pycache__/processmanager.cpython-38.pyc +0 -0
  19. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/gui/test/__pycache__/__init__.cpython-38.pyc +0 -0
  20. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/gui/test/__pycache__/test_process_manager.cpython-38.pyc +0 -0
  21. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/resources/__pycache__/__init__.cpython-38.pyc +0 -0
  22. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/test/__pycache__/__init__.cpython-38.pyc +0 -0
  23. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/utils/__pycache__/__init__.cpython-38.pyc +0 -0
  24. users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview/utils/__pycache__/singleton.cpython-38.pyc +0 -0
  25. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/version.py +1 -1
  26. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview-0.3.2-py3.8.egg-info}/PKG-INFO +1 -1
  27. processview-0.3.1/LICENSE +0 -0
  28. processview-0.3.1/README.md +0 -12
  29. processview-0.3.1/processview.egg-info/PKG-INFO +0 -40
  30. processview-0.3.1/setup.cfg +0 -4
  31. processview-0.3.1/setup.py +0 -607
  32. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/__init__.py +0 -0
  33. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/__init__.py +0 -0
  34. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/dataset.py +0 -0
  35. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/helpers.py +0 -0
  36. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/manager/__init__.py +0 -0
  37. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/manager/test/__init__.py +0 -0
  38. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/manager/test/test_manager.py +0 -0
  39. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/setup.py +0 -0
  40. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/superviseprocess.py +0 -0
  41. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/core/test/__init__.py +0 -0
  42. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/gui/__init__.py +0 -0
  43. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/gui/icons.py +0 -0
  44. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/gui/messagebox.py +0 -0
  45. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/gui/processmanager.py +0 -0
  46. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/gui/test/__init__.py +0 -0
  47. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/gui/test/test_process_manager.py +0 -0
  48. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/resources/__init__.py +0 -0
  49. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/resources/gui/icons/advancement.png +0 -0
  50. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/resources/gui/icons/advancement.svg +0 -0
  51. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/resources/gui/icons/magnifying_glass.png +0 -0
  52. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/resources/gui/icons/magnifying_glass.svg +0 -0
  53. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/setup.py +0 -0
  54. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/test/__init__.py +0 -0
  55. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/utils/__init__.py +0 -0
  56. {processview-0.3.1 → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages}/processview/utils/singleton.py +0 -0
  57. {processview-0.3.1/processview.egg-info → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview-0.3.2-py3.8.egg-info}/SOURCES.txt +0 -0
  58. {processview-0.3.1/processview.egg-info → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview-0.3.2-py3.8.egg-info}/dependency_links.txt +0 -0
  59. {processview-0.3.1/processview.egg-info → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview-0.3.2-py3.8.egg-info}/not-zip-safe +0 -0
  60. {processview-0.3.1/processview.egg-info → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview-0.3.2-py3.8.egg-info}/requires.txt +0 -0
  61. {processview-0.3.1/processview.egg-info → users/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.8/site-packages/processview-0.3.2-py3.8.egg-info}/top_level.txt +0 -0
@@ -185,6 +185,11 @@ class ProcessManager:
185
185
  :param str info: details about the error or success
186
186
  :return:
187
187
  """
188
+ from processview.core.superviseprocess import (
189
+ SuperviseProcess,
190
+ ) # avoid cyclic import
191
+ if not isinstance(process, SuperviseProcess):
192
+ _logger.warning(f"Unable to update dataset {dataset} state. Process does not inherit from SuperviseProcess")
188
193
  if process.process_id not in self._processes:
189
194
  self.register(process)
190
195
  if process.process_id not in self._dataset_process_states:
@@ -77,7 +77,7 @@ RELEASE_LEVEL_VALUE = {
77
77
 
78
78
  MAJOR = 0
79
79
  MINOR = 3
80
- MICRO = 1
80
+ MICRO = 2
81
81
  RELEV = "final" # <16
82
82
  SERIAL = 0 # <16
83
83
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: processview
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Library workflow process supervision
5
5
  Home-page: https://gitlab.esrf.fr/workflow/processview
6
6
  Author: data analysis unit
processview-0.3.1/LICENSE DELETED
File without changes
@@ -1,12 +0,0 @@
1
- # Description
2
-
3
- `processview` Toolkit for workflow processes supervision.
4
-
5
- A workflow process must inherit from "SuperviseProcess".
6
- This way it can provide information to the "manager". Several processes can be associated to the same "process".
7
-
8
- # Installation
9
-
10
- ``` python
11
- pip install processview[full]
12
- ```
@@ -1,40 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: processview
3
- Version: 0.3.1
4
- Summary: Library workflow process supervision
5
- Home-page: https://gitlab.esrf.fr/workflow/processview
6
- Author: data analysis unit
7
- Author-email: henri.payno@esrf.fr
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Environment :: Console
12
- Classifier: Environment :: X11 Applications :: Qt
13
- Classifier: Intended Audience :: Education
14
- Classifier: Intended Audience :: Science/Research
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Natural Language :: English
17
- Classifier: Operating System :: POSIX
18
- Classifier: Programming Language :: Python :: 3.6
19
- Classifier: Programming Language :: Python :: 3.7
20
- Classifier: Programming Language :: Python :: 3.8
21
- Classifier: Programming Language :: Python :: 3.9
22
- Classifier: Topic :: Scientific/Engineering :: Physics
23
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
- Provides-Extra: full
25
- License-File: LICENSE
26
-
27
- # Description
28
-
29
- `processview` Toolkit for workflow processes supervision.
30
-
31
- A workflow process must inherit from "SuperviseProcess".
32
- This way it can provide information to the "manager". Several processes can be associated to the same "process".
33
-
34
- # Installation
35
-
36
- ``` python
37
- pip install processview[full]
38
- ```
39
-
40
-
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
@@ -1,607 +0,0 @@
1
- #!/usr/bin/python
2
- # coding: utf8
3
- # /*##########################################################################
4
- #
5
- # Copyright (c) 2015-2017 European Synchrotron Radiation Facility
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
24
- #
25
- # ###########################################################################*/
26
-
27
- __authors__ = ["Henri Payno", "Jérôme Kieffer", "Thomas Vincent"]
28
- __date__ = "29/01/2021"
29
- __license__ = "MIT"
30
-
31
-
32
- import sys
33
- import os
34
- import logging
35
-
36
- logging.basicConfig(level=logging.INFO)
37
-
38
- logger = logging.getLogger(__name__)
39
-
40
-
41
- from setuptools import find_packages
42
-
43
- try:
44
- from setuptools import Command
45
- from setuptools.command.build_py import build_py as _build_py
46
- from setuptools.command.build_ext import build_ext
47
- from setuptools.command.sdist import sdist
48
-
49
- logger.info("Use setuptools")
50
- except ImportError:
51
- try:
52
- from numpy.distutils.core import Command
53
- except ImportError:
54
- from distutils.core import Command
55
- from distutils.command.build_py import build_py as _build_py
56
- from distutils.command.build_ext import build_ext
57
- from distutils.command.sdist import sdist
58
-
59
- logger.info("Use distutils")
60
-
61
- try:
62
- import sphinx
63
- import sphinx.util.console
64
-
65
- sphinx.util.console.color_terminal = lambda: False
66
- from sphinx.setup_command import BuildDoc
67
- except ImportError:
68
- sphinx = None
69
- from collections import namedtuple
70
-
71
-
72
- PROJECT = "processview"
73
-
74
- if "LANG" not in os.environ and sys.platform == "darwin" and sys.version_info[0] > 2:
75
- print(
76
- """WARNING: the LANG environment variable is not defined,
77
- an utf-8 LANG is mandatory to use setup.py, you may face unexpected UnicodeError.
78
- export LANG=en_US.utf-8
79
- export LC_ALL=en_US.utf-8
80
- """
81
- )
82
-
83
-
84
- def get_version():
85
- """Returns current version number from version.py file"""
86
- from processview.version import strictversion
87
-
88
- return strictversion
89
-
90
-
91
- def get_readme():
92
- """Returns content of README.md file"""
93
- import io
94
-
95
- dirname = os.path.dirname(os.path.abspath(__file__))
96
- filename = os.path.join(dirname, "README.md")
97
- with io.open(filename, "r", encoding="utf-8") as fp:
98
- long_description = fp.read()
99
- return long_description
100
-
101
-
102
- classifiers = [
103
- "Development Status :: 4 - Beta",
104
- "Environment :: Console",
105
- "Environment :: X11 Applications :: Qt",
106
- "Intended Audience :: Education",
107
- "Intended Audience :: Science/Research",
108
- "License :: OSI Approved :: MIT License",
109
- "Natural Language :: English",
110
- "Operating System :: POSIX",
111
- "Programming Language :: Python :: 3.6",
112
- "Programming Language :: Python :: 3.7",
113
- "Programming Language :: Python :: 3.8",
114
- "Programming Language :: Python :: 3.9",
115
- "Topic :: Scientific/Engineering :: Physics",
116
- "Topic :: Software Development :: Libraries :: Python Modules",
117
- ]
118
-
119
-
120
- ########
121
- # Test #
122
- ########
123
-
124
-
125
- class PyTest(Command):
126
- """Command to start tests running the script: run_tests.py -i"""
127
-
128
- user_options = []
129
-
130
- def initialize_options(self):
131
- pass
132
-
133
- def finalize_options(self):
134
- pass
135
-
136
- def run(self):
137
- import subprocess
138
-
139
- errno = subprocess.call([sys.executable, "run_tests.py"])
140
- if errno != 0:
141
- raise SystemExit(errno)
142
-
143
-
144
- # ################### #
145
- # build_doc command #
146
- # ################### #
147
-
148
- if sphinx is None:
149
-
150
- class SphinxExpectedCommand(Command):
151
- """Command to inform that sphinx is missing"""
152
-
153
- user_options = []
154
-
155
- def initialize_options(self):
156
- pass
157
-
158
- def finalize_options(self):
159
- pass
160
-
161
- def run(self):
162
- raise RuntimeError(
163
- "Sphinx is required to build or test the documentation.\n"
164
- "Please install Sphinx (http://www.sphinx-doc.org)."
165
- )
166
-
167
-
168
- class BuildMan(Command):
169
- """Command to build man pages"""
170
-
171
- user_options = []
172
-
173
- def initialize_options(self):
174
- pass
175
-
176
- def finalize_options(self):
177
- pass
178
-
179
- def entry_points_iterator(self):
180
- """Iterate other entry points available on the project."""
181
- entry_points = self.distribution.entry_points
182
- console_scripts = entry_points.get("console_scripts", [])
183
- gui_scripts = entry_points.get("gui_scripts", [])
184
- scripts = []
185
- scripts.extend(console_scripts)
186
- scripts.extend(gui_scripts)
187
- for script in scripts:
188
- # Remove ending extra dependencies
189
- script = script.split("[")[0]
190
- elements = script.split("=")
191
- target_name = elements[0].strip()
192
- elements = elements[1].split(":")
193
- module_name = elements[0].strip()
194
- function_name = elements[1].strip()
195
- yield target_name, module_name, function_name
196
-
197
- def run_targeted_script(self, target_name, script_name, env, log_output=False):
198
- """Execute targeted script using --help and --version to help checking
199
- errors. help2man is not very helpful to do it for us.
200
- :return: True is both return code are equal to 0
201
- :rtype: bool
202
- """
203
- import subprocess
204
-
205
- if log_output:
206
- extra_args = {}
207
- else:
208
- try:
209
- # Python 3
210
- from subprocess import DEVNULL
211
- except ImportError:
212
- # Python 2
213
- import os
214
-
215
- DEVNULL = open(os.devnull, "wb")
216
- extra_args = {"stdout": DEVNULL, "stderr": DEVNULL}
217
-
218
- succeeded = True
219
- command_line = [sys.executable, script_name, "--help"]
220
- if log_output:
221
- logger.info("See the following execution of: %s", " ".join(command_line))
222
- p = subprocess.Popen(command_line, env=env, **extra_args)
223
- status = p.wait()
224
- if log_output:
225
- logger.info("Return code: %s", status)
226
- succeeded = succeeded and status == 0
227
- command_line = [sys.executable, script_name, "--version"]
228
- if log_output:
229
- logger.info("See the following execution of: %s", " ".join(command_line))
230
- p = subprocess.Popen(command_line, env=env, **extra_args)
231
- status = p.wait()
232
- if log_output:
233
- logger.info("Return code: %s", status)
234
- succeeded = succeeded and status == 0
235
- return succeeded
236
-
237
- def run(self):
238
- build = self.get_finalized_command("build")
239
- path = sys.path
240
- path.insert(0, os.path.abspath(build.build_lib))
241
-
242
- env = dict((str(k), str(v)) for k, v in os.environ.items())
243
- env["PYTHONPATH"] = os.pathsep.join(path)
244
-
245
- import subprocess
246
-
247
- status = subprocess.call(["mkdir", "-p", "build/man"])
248
- if status != 0:
249
- raise RuntimeError("Fail to create build/man directory")
250
-
251
- import tempfile
252
- import stat
253
-
254
- script_name = None
255
-
256
- entry_points = self.entry_points_iterator()
257
- for target_name, module_name, function_name in entry_points:
258
- logger.info("Build man for entry-point target '%s'" % target_name)
259
-
260
- # help2man expect a single executable file to extract the help
261
- # we create it, execute it, and delete it at the end
262
- py3 = sys.version_info >= (3, 0)
263
- try:
264
- # create a launcher using the right python interpreter
265
- script_fid, script_name = tempfile.mkstemp(
266
- prefix="%s_" % target_name, text=True
267
- )
268
- script = os.fdopen(script_fid, "wt")
269
- script.write("#!%s\n" % sys.executable)
270
- script.write("import %s as app\n" % module_name)
271
- script.write("app.%s()\n" % function_name)
272
- script.close()
273
- # make it executable
274
- mode = os.stat(script_name).st_mode
275
- os.chmod(script_name, mode + stat.S_IEXEC)
276
-
277
- # execute help2man
278
- man_file = "build/man/%s.1" % target_name
279
- command_line = ["help2man", script_name, "-o", man_file]
280
- if not py3:
281
- # Before Python 3.4, ArgParser --version was using
282
- # stderr to print the version
283
- command_line.append("--no-discard-stderr")
284
- # Then we dont know if the documentation will contains
285
- # durtty things
286
- succeeded = self.run_targeted_script(
287
- target_name, script_name, env, False
288
- )
289
- if not succeeded:
290
- logger.info(
291
- "Error while generating man file for target '%s'.",
292
- target_name,
293
- )
294
- self.run_targeted_script(target_name, script_name, env, True)
295
- raise RuntimeError(
296
- "Fail to generate '%s' man documentation" % target_name
297
- )
298
-
299
- p = subprocess.Popen(command_line, env=env)
300
- status = p.wait()
301
- if status != 0:
302
- logger.info(
303
- "Error while generating man file for target '%s'.", target_name
304
- )
305
- self.run_targeted_script(target_name, script_name, env, True)
306
- raise RuntimeError(
307
- "Fail to generate '%s' man documentation" % target_name
308
- )
309
- finally:
310
- # clean up the script
311
- if script_name is not None:
312
- os.remove(script_name)
313
-
314
-
315
- if sphinx is not None:
316
-
317
- class BuildDocCommand(BuildDoc):
318
- """Command to build documentation using sphinx.
319
-
320
- Project should have already be built.
321
- """
322
-
323
- def run(self):
324
- # make sure the python path is pointing to the newly built
325
- # code so that the documentation is built on this and not a
326
- # previously installed version
327
-
328
- build = self.get_finalized_command("build")
329
- sys.path.insert(0, os.path.abspath(build.build_lib))
330
-
331
- # Build the Users Guide in HTML and TeX format
332
- for builder in ["html", "htmlhelp"]:
333
- self.builder = builder
334
- self.builder_target_dir = os.path.join(self.build_dir, builder)
335
- self.mkpath(self.builder_target_dir)
336
- BuildDoc.run(self)
337
- sys.path.pop(0)
338
-
339
- class BuildDocAndGenerateScreenshotCommand(BuildDocCommand):
340
- def run(self):
341
- old = os.environ.get("DIRECTIVE_SNAPSHOT_QT")
342
- os.environ["DIRECTIVE_SNAPSHOT_QT"] = "True"
343
- BuildDocCommand.run(self)
344
- if old is not None:
345
- os.environ["DIRECTIVE_SNAPSHOT_QT"] = old
346
- else:
347
- del os.environ["DIRECTIVE_SNAPSHOT_QT"]
348
-
349
-
350
- else:
351
- BuildDocCommand = SphinxExpectedCommand
352
- BuildDocAndGenerateScreenshotCommand = SphinxExpectedCommand
353
-
354
-
355
- # ################### #
356
- # test_doc command #
357
- # ################### #
358
-
359
- if sphinx is not None:
360
-
361
- class TestDocCommand(BuildDoc):
362
- """Command to test the documentation using sphynx doctest.
363
-
364
- http://www.sphinx-doc.org/en/1.4.8/ext/doctest.html
365
- """
366
-
367
- def run(self):
368
- # make sure the python path is pointing to the newly built
369
- # code so that the documentation is built on this and not a
370
- # previously installed version
371
-
372
- build = self.get_finalized_command("build")
373
- sys.path.insert(0, os.path.abspath(build.build_lib))
374
-
375
- # Build the Users Guide in HTML and TeX format
376
- for builder in ["doctest"]:
377
- self.builder = builder
378
- self.builder_target_dir = os.path.join(self.build_dir, builder)
379
- self.mkpath(self.builder_target_dir)
380
- BuildDoc.run(self)
381
- sys.path.pop(0)
382
-
383
-
384
- else:
385
- TestDocCommand = SphinxExpectedCommand
386
-
387
- # ############################# #
388
- # numpy.distutils Configuration #
389
- # ############################# #
390
-
391
-
392
- def configuration(parent_package="", top_path=None):
393
- """Recursive construction of package info to be used in setup().
394
-
395
- See http://docs.scipy.org/doc/numpy/reference/distutils.html#numpy.distutils.misc_util.Configuration
396
- """
397
- try:
398
- from numpy.distutils.misc_util import Configuration
399
- except ImportError:
400
- raise ImportError(
401
- "To install this package, you must install numpy first\n"
402
- "(See https://pypi.python.org/pypi/numpy)"
403
- )
404
- config = Configuration(None, parent_package, top_path)
405
- config.set_options(
406
- ignore_setup_xxx_py=True,
407
- assume_default_configuration=True,
408
- delegate_options_to_subpackages=True,
409
- quiet=True,
410
- )
411
- config.add_subpackage(PROJECT)
412
- return config
413
-
414
-
415
- class sdist_debian(sdist):
416
- """
417
- Tailor made sdist for debian
418
- * remove auto-generated doc
419
- * remove cython generated .c files
420
- * remove cython generated .c files
421
- * remove .bat files
422
- * include .l man files
423
- """
424
-
425
- @staticmethod
426
- def get_debian_name():
427
- from processview import version
428
-
429
- name = "%s_%s" % (PROJECT, version.debianversion)
430
- return name
431
-
432
- def prune_file_list(self):
433
- sdist.prune_file_list(self)
434
- to_remove = [
435
- "doc/build",
436
- "doc/pdf",
437
- "doc/html",
438
- "pylint",
439
- "epydoc",
440
- "doc/htmlhelp",
441
- ]
442
- print("Removing files for debian")
443
- for rm in to_remove:
444
- self.filelist.exclude_pattern(pattern="*", anchor=False, prefix=rm)
445
-
446
- def make_distribution(self):
447
- self.prune_file_list()
448
- sdist.make_distribution(self)
449
- dest = self.archive_files[0]
450
- dirname, basename = os.path.split(dest)
451
- base, ext = os.path.splitext(basename)
452
- while ext in [".zip", ".tar", ".bz2", ".gz", ".Z", ".lz", ".orig"]:
453
- base, ext = os.path.splitext(base)
454
- if ext:
455
- dest = "".join((base, ext))
456
- else:
457
- dest = base
458
- # sp = dest.split("-")
459
- # base = sp[:-1]
460
- # nr = sp[-1]
461
- debian_arch = os.path.join(dirname, self.get_debian_name() + ".orig.tar.gz")
462
- os.rename(self.archive_files[0], debian_arch)
463
- self.archive_files = [debian_arch]
464
- print("Building debian .orig.tar.gz in %s" % self.archive_files[0])
465
-
466
-
467
- # ##### #
468
- # setup #
469
- # ##### #
470
-
471
- PACKAGES = find_packages()
472
-
473
-
474
- def get_project_configuration(dry_run):
475
- """Returns project arguments for setup"""
476
- install_requires = [
477
- # for most of the computation
478
- "silx>=0.14b",
479
- ]
480
-
481
- full_requires = [
482
- "PyQt5",
483
- ]
484
-
485
- extras_require = {"full": full_requires}
486
-
487
- setup_requires = ["setuptools", "numpy"]
488
-
489
- package_data = {
490
- # Resources files for processview library
491
- "processview.resources": [
492
- "gui/icons/*.png",
493
- "gui/icons/*.svg",
494
- "gui/icons/*.npy",
495
- ],
496
- }
497
- entry_points = {}
498
-
499
- cmdclass = dict(
500
- test=PyTest,
501
- build_doc=BuildDocCommand,
502
- build_screenshots=BuildDocAndGenerateScreenshotCommand,
503
- test_doc=TestDocCommand,
504
- build_man=BuildMan,
505
- debian_src=sdist_debian,
506
- )
507
-
508
- if dry_run:
509
- # DRY_RUN implies actions which do not require NumPy
510
- #
511
- # And they are required to succeed without Numpy for example when
512
- # pip is used to install processview when Numpy is not yet present in
513
- # the system.
514
- setup_kwargs = {}
515
- else:
516
- config = configuration()
517
- setup_kwargs = config.todict()
518
- setup_kwargs.update(
519
- name=PROJECT,
520
- version=get_version(),
521
- url="https://gitlab.esrf.fr/workflow/processview",
522
- author="data analysis unit",
523
- author_email="henri.payno@esrf.fr",
524
- classifiers=classifiers,
525
- description="Library workflow process supervision",
526
- long_description=get_readme(),
527
- packages=PACKAGES,
528
- install_requires=install_requires,
529
- setup_requires=setup_requires,
530
- cmdclass=cmdclass,
531
- package_data=package_data,
532
- zip_safe=False,
533
- entry_points=entry_points,
534
- extras_require=extras_require,
535
- )
536
- return setup_kwargs
537
-
538
-
539
- def setup_package():
540
- """Run setup(**kwargs)
541
-
542
- Depending on the command, it either runs the complete setup which depends on numpy,
543
- or a *dry run* setup with no dependency on numpy.
544
- """
545
-
546
- # Check if action requires build/install
547
- dry_run = len(sys.argv) == 1 or (
548
- len(sys.argv) >= 2
549
- and (
550
- "--help" in sys.argv[1:]
551
- or sys.argv[1]
552
- in ("--help-commands", "egg_info", "--version", "clean", "--name")
553
- )
554
- )
555
-
556
- if dry_run:
557
- # DRY_RUN implies actions which do not require dependancies, like NumPy
558
- try:
559
- from setuptools import setup
560
-
561
- logger.info("Use setuptools.setup")
562
- except ImportError:
563
- from distutils.core import setup
564
-
565
- logger.info("Use distutils.core.setup")
566
- else:
567
- try:
568
- from setuptools import setup
569
- except ImportError:
570
- from numpy.distutils.core import setup
571
-
572
- logger.info("Use numpydistutils.setup")
573
-
574
- setup_kwargs = get_project_configuration(dry_run)
575
- setup(**setup_kwargs)
576
-
577
-
578
- DATA_FILES = [
579
- # Data files that will be installed outside site-packages folder
580
- ]
581
-
582
-
583
- def include_documentation(local_dir, install_dir):
584
- global DATA_FILES
585
- if "bdist_wheel" in sys.argv and not os.path.exists(local_dir):
586
- print(
587
- "Directory '{}' does not exist. "
588
- "Please build documentation before running bdist_wheel.".format(
589
- os.path.abspath(local_dir)
590
- )
591
- )
592
- sys.exit(0)
593
-
594
- doc_files = []
595
- for dirpath, dirs, files in os.walk(local_dir):
596
- doc_files.append(
597
- (
598
- dirpath.replace(local_dir, install_dir),
599
- [os.path.join(dirpath, f) for f in files],
600
- )
601
- )
602
- DATA_FILES.extend(doc_files)
603
-
604
-
605
- if __name__ == "__main__":
606
- include_documentation("build/sphinx/html", "help/processview")
607
- setup_package()