repcmd 1.1.0__tar.gz → 1.3.0__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.
- {repcmd-1.1.0 → repcmd-1.3.0}/PKG-INFO +7 -2
- {repcmd-1.1.0 → repcmd-1.3.0}/pyproject.toml +1 -1
- repcmd-1.3.0/repcmd/__init__.py +49 -0
- {repcmd-1.1.0 → repcmd-1.3.0}/repcmd/setup.py +1 -1
- repcmd-1.1.0/repcmd/__init__.py +0 -15
- {repcmd-1.1.0 → repcmd-1.3.0}/LICENSE-MIT.txt +0 -0
- {repcmd-1.1.0 → repcmd-1.3.0}/README.md +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: repcmd
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary:
|
|
5
5
|
License: MIT
|
|
6
|
+
License-File: LICENSE-MIT.txt
|
|
6
7
|
Author: tamuto
|
|
7
8
|
Author-email: tamuto@infodb.jp
|
|
8
9
|
Requires-Python: >=3.9,<4.0
|
|
@@ -11,6 +12,10 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
12
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
14
19
|
Description-Content-Type: text/markdown
|
|
15
20
|
|
|
16
21
|
# Python Binding Tool for 'repcmd'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
__version__ = '1.3.0'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RepcmdError(RuntimeError):
|
|
9
|
+
def __init__(self, message, returncode, stderr):
|
|
10
|
+
super().__init__(message)
|
|
11
|
+
self.returncode = returncode
|
|
12
|
+
self.stderr = stderr
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def execute(data, font_dir=None):
|
|
16
|
+
"""Generate a PDF from report data and return it as bytes.
|
|
17
|
+
|
|
18
|
+
font_dir: directory containing jasperreports_extension.properties,
|
|
19
|
+
the font family XML and the font files (see etc/fonts in the
|
|
20
|
+
repository). If omitted, the REPCMD_FONT_DIR environment variable
|
|
21
|
+
is used.
|
|
22
|
+
"""
|
|
23
|
+
font_dir = font_dir or os.environ.get('REPCMD_FONT_DIR')
|
|
24
|
+
env = dict(os.environ)
|
|
25
|
+
if font_dir:
|
|
26
|
+
# repcmd.sh changes its working directory, so pass an absolute path
|
|
27
|
+
font_dir = os.path.abspath(font_dir)
|
|
28
|
+
if not os.path.isdir(font_dir):
|
|
29
|
+
raise FileNotFoundError(f'font directory not found: {font_dir}')
|
|
30
|
+
env['REPCMD_FONT_DIR'] = font_dir
|
|
31
|
+
|
|
32
|
+
inp = json.dumps(data, ensure_ascii=False)
|
|
33
|
+
cmd = f'{os.path.dirname(__file__)}/repcmd.sh'
|
|
34
|
+
result = subprocess.run(
|
|
35
|
+
[cmd],
|
|
36
|
+
input=inp.encode(),
|
|
37
|
+
stdout=subprocess.PIPE,
|
|
38
|
+
stderr=subprocess.PIPE,
|
|
39
|
+
env=env)
|
|
40
|
+
stderr = result.stderr.decode(errors='replace')
|
|
41
|
+
if result.returncode != 0:
|
|
42
|
+
raise RepcmdError(
|
|
43
|
+
f'repcmd failed (exit code {result.returncode}):\n{stderr}',
|
|
44
|
+
result.returncode, stderr)
|
|
45
|
+
if not result.stdout:
|
|
46
|
+
raise RepcmdError(
|
|
47
|
+
f'repcmd produced no output:\n{stderr}',
|
|
48
|
+
result.returncode, stderr)
|
|
49
|
+
return result.stdout
|
repcmd-1.1.0/repcmd/__init__.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import subprocess
|
|
2
|
-
import json
|
|
3
|
-
import os
|
|
4
|
-
|
|
5
|
-
__version__ = '1.0.1'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def execute(data):
|
|
9
|
-
inp = json.dumps(data, ensure_ascii=False)
|
|
10
|
-
cmd = f'{os.path.dirname(__file__)}/repcmd.sh'
|
|
11
|
-
result = subprocess.run(
|
|
12
|
-
[cmd],
|
|
13
|
-
input=inp.encode(),
|
|
14
|
-
stdout=subprocess.PIPE)
|
|
15
|
-
return result.stdout
|
|
File without changes
|
|
File without changes
|