tinyprint 0.2.4__tar.gz → 0.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.
- tinyprint-0.3.0/.gitignore +134 -0
- tinyprint-0.3.0/.woodpecker/test.yaml +32 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/PKG-INFO +23 -6
- {tinyprint-0.2.4 → tinyprint-0.3.0}/README.md +19 -2
- tinyprint-0.3.0/bin/t +5 -0
- tinyprint-0.3.0/bin/tinyprint +13 -0
- tinyprint-0.3.0/bin/upload2pypi +5 -0
- tinyprint-0.3.0/default.nix +57 -0
- tinyprint-0.3.0/nix/python-escpos/default.nix +37 -0
- tinyprint-0.3.0/nix/sources.json +14 -0
- tinyprint-0.3.0/nix/sources.nix +194 -0
- tinyprint-0.3.0/pypishell.nix +24 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/pyproject.toml +3 -2
- tinyprint-0.3.0/screenshot.jpg +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-horizontal-copies_1-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-horizontal-copies_1-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-horizontal-copies_2-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-horizontal-copies_2-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-vertical-copies_1-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-vertical-copies_1-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-vertical-copies_2-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-vertical-copies_2-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-horizontal-copies_1-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-horizontal-copies_1-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-horizontal-copies_2-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-horizontal-copies_2-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-vertical-copies_1-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-vertical-copies_1-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-vertical-copies_2-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-vertical-copies_2-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[text-horizontal-copies_1-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[text-horizontal-copies_1-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[text-horizontal-copies_2-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[text-horizontal-copies_2-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[text-vertical-copies_1-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[text-vertical-copies_1-nocut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[text-vertical-copies_2-cut].raw +0 -0
- tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[text-vertical-copies_2-nocut].raw +0 -0
- tinyprint-0.3.0/tests/conftest.py +29 -0
- tinyprint-0.3.0/tests/data/images/test-0.png +0 -0
- tinyprint-0.3.0/tests/data/images/test-1.png +0 -0
- tinyprint-0.3.0/tests/data/images/test-2.png +0 -0
- tinyprint-0.3.0/tests/data/images/test-3.png +0 -0
- tinyprint-0.3.0/tests/data/pdfs/test.pdf +0 -0
- tinyprint-0.3.0/tests/data/text/cat.jpg +0 -0
- tinyprint-0.3.0/tests/data/text/test.md +15 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tests/test_gui.py +178 -98
- tinyprint-0.3.0/tests/test_gui_misc.py +37 -0
- tinyprint-0.3.0/tests/test_profile.py +60 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/__init__.py +1 -0
- tinyprint-0.3.0/tinyprint/constants.py +1 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/gui.py +113 -23
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/gui_misc.py +49 -13
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/job.py +4 -3
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/preprocessor.py +4 -1
- tinyprint-0.3.0/tinyprint/profile.py +56 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint.egg-info/PKG-INFO +23 -6
- tinyprint-0.3.0/tinyprint.egg-info/SOURCES.txt +74 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint.egg-info/requires.txt +2 -1
- tinyprint-0.2.4/tinyprint.egg-info/SOURCES.txt +0 -27
- {tinyprint-0.2.4 → tinyprint-0.3.0}/LICENSE +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/setup.cfg +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tests/test_integration.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tests/test_job.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tests/test_jobconfig.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/__main__.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/config.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/jobconfig.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/patches/__init__.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/patches/escpos.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/patches/mako.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/printer/__init__.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/printer/manager.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint/printer/profile.py +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint.egg-info/dependency_links.txt +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint.egg-info/entry_points.txt +0 -0
- {tinyprint-0.2.4 → tinyprint-0.3.0}/tinyprint.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# ide / editor config files
|
|
2
|
+
.vscode
|
|
3
|
+
.idea
|
|
4
|
+
.vim
|
|
5
|
+
|
|
6
|
+
# Byte-compiled / optimized / DLL files
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*$py.class
|
|
10
|
+
|
|
11
|
+
# C extensions
|
|
12
|
+
*.so
|
|
13
|
+
|
|
14
|
+
# Distribution / packaging
|
|
15
|
+
.Python
|
|
16
|
+
build/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
downloads/
|
|
20
|
+
eggs/
|
|
21
|
+
.eggs/
|
|
22
|
+
lib/
|
|
23
|
+
lib64/
|
|
24
|
+
parts/
|
|
25
|
+
sdist/
|
|
26
|
+
var/
|
|
27
|
+
wheels/
|
|
28
|
+
pip-wheel-metadata/
|
|
29
|
+
share/python-wheels/
|
|
30
|
+
*.egg-info/
|
|
31
|
+
.installed.cfg
|
|
32
|
+
*.egg
|
|
33
|
+
MANIFEST
|
|
34
|
+
|
|
35
|
+
# PyInstaller
|
|
36
|
+
# Usually these files are written by a python script from a template
|
|
37
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
38
|
+
*.manifest
|
|
39
|
+
*.spec
|
|
40
|
+
|
|
41
|
+
# Installer logs
|
|
42
|
+
pip-log.txt
|
|
43
|
+
pip-delete-this-directory.txt
|
|
44
|
+
|
|
45
|
+
# Unit test / coverage reports
|
|
46
|
+
htmlcov/
|
|
47
|
+
.tox/
|
|
48
|
+
.nox/
|
|
49
|
+
.coverage
|
|
50
|
+
.coverage.*
|
|
51
|
+
.cache
|
|
52
|
+
nosetests.xml
|
|
53
|
+
coverage.xml
|
|
54
|
+
*.cover
|
|
55
|
+
*.py,cover
|
|
56
|
+
.hypothesis/
|
|
57
|
+
.pytest_cache/
|
|
58
|
+
|
|
59
|
+
# Translations
|
|
60
|
+
*.mo
|
|
61
|
+
*.pot
|
|
62
|
+
|
|
63
|
+
# Django stuff:
|
|
64
|
+
*.log
|
|
65
|
+
local_settings.py
|
|
66
|
+
db.sqlite3
|
|
67
|
+
db.sqlite3-journal
|
|
68
|
+
|
|
69
|
+
# Flask stuff:
|
|
70
|
+
instance/
|
|
71
|
+
.webassets-cache
|
|
72
|
+
|
|
73
|
+
# Scrapy stuff:
|
|
74
|
+
.scrapy
|
|
75
|
+
|
|
76
|
+
# Sphinx documentation
|
|
77
|
+
docs/_build/
|
|
78
|
+
|
|
79
|
+
# PyBuilder
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
.python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
#Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
100
|
+
__pypackages__/
|
|
101
|
+
|
|
102
|
+
# Celery stuff
|
|
103
|
+
celerybeat-schedule
|
|
104
|
+
celerybeat.pid
|
|
105
|
+
|
|
106
|
+
# SageMath parsed files
|
|
107
|
+
*.sage.py
|
|
108
|
+
|
|
109
|
+
# Environments
|
|
110
|
+
.env
|
|
111
|
+
.venv
|
|
112
|
+
env/
|
|
113
|
+
venv/
|
|
114
|
+
ENV/
|
|
115
|
+
env.bak/
|
|
116
|
+
venv.bak/
|
|
117
|
+
|
|
118
|
+
# Spyder project settings
|
|
119
|
+
.spyderproject
|
|
120
|
+
.spyproject
|
|
121
|
+
|
|
122
|
+
# Rope project settings
|
|
123
|
+
.ropeproject
|
|
124
|
+
|
|
125
|
+
# mkdocs documentation
|
|
126
|
+
/site
|
|
127
|
+
|
|
128
|
+
# mypy
|
|
129
|
+
.mypy_cache/
|
|
130
|
+
.dmypy.json
|
|
131
|
+
dmypy.json
|
|
132
|
+
|
|
133
|
+
# Pyre type checker
|
|
134
|
+
.pyre/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
when:
|
|
2
|
+
- event: push
|
|
3
|
+
branch: main
|
|
4
|
+
|
|
5
|
+
steps:
|
|
6
|
+
- name: test and coverage
|
|
7
|
+
image: python:${TAG}
|
|
8
|
+
commands:
|
|
9
|
+
# Install poppler for pdf print support
|
|
10
|
+
# Use xvfb to simulate X display for GUI tests
|
|
11
|
+
- apt-get update && apt-get install -y poppler-utils xvfb
|
|
12
|
+
- pip install virtualenv
|
|
13
|
+
- virtualenv .tenv
|
|
14
|
+
- .tenv/bin/pip install coverage
|
|
15
|
+
- .tenv/bin/pip install .[dev]
|
|
16
|
+
- .tenv/bin/mypy -p tinyprint
|
|
17
|
+
- mkdir t/
|
|
18
|
+
- cd t/
|
|
19
|
+
- xvfb-run -a -s "-screen 0 1024x768x24" ../.tenv/bin/coverage run -m pytest ../.
|
|
20
|
+
# This makes sure the next step can upload the report.
|
|
21
|
+
- echo "# Python ${TAG} coverage report\n\n" > coverage-${TAG}.md
|
|
22
|
+
- ../.tenv/bin/coverage report --format=markdown >> coverage-${TAG}.md
|
|
23
|
+
when:
|
|
24
|
+
- event: push
|
|
25
|
+
branch: main
|
|
26
|
+
|
|
27
|
+
matrix:
|
|
28
|
+
TAG:
|
|
29
|
+
- 3.10
|
|
30
|
+
- 3.11
|
|
31
|
+
- 3.12
|
|
32
|
+
- 3.13
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: tinyprint
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: ui & cli to print zines with esc/pos printer
|
|
5
5
|
Author-email: Levin Eric Zimmermann <levin.eric.zimmermann@posteo.com>
|
|
6
6
|
License: GPL
|
|
@@ -9,8 +9,9 @@ Description-Content-Type: text/markdown
|
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
Requires-Dist: python-escpos[serial,usb]>=3.1
|
|
11
11
|
Requires-Dist: dataclasses-json>=0.6.0
|
|
12
|
-
Requires-Dist: marko
|
|
12
|
+
Requires-Dist: marko==2.1.2
|
|
13
13
|
Requires-Dist: pdf2image>=1.17.0
|
|
14
|
+
Requires-Dist: platformdirs>=4.5.0
|
|
14
15
|
Provides-Extra: dev
|
|
15
16
|
Requires-Dist: coverage; extra == "dev"
|
|
16
17
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -18,7 +19,6 @@ Requires-Dist: syrupy; extra == "dev"
|
|
|
18
19
|
Requires-Dist: mypy; extra == "dev"
|
|
19
20
|
Requires-Dist: types-six; extra == "dev"
|
|
20
21
|
Requires-Dist: types-pillow; extra == "dev"
|
|
21
|
-
Dynamic: license-file
|
|
22
22
|
|
|
23
23
|
# tinyprint
|
|
24
24
|
|
|
@@ -34,13 +34,14 @@ Open a console and type:
|
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
|
|
37
|
+
brew install poppler
|
|
37
38
|
brew install python
|
|
38
39
|
brew install python-tk
|
|
39
40
|
brew install pipx
|
|
40
41
|
pipx install tinyprint
|
|
41
42
|
```
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
### Linux
|
|
44
45
|
|
|
45
46
|
Install python, and then just use pip:
|
|
46
47
|
|
|
@@ -48,6 +49,22 @@ Install python, and then just use pip:
|
|
|
48
49
|
pip3 install tinyprint
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
If you want to print PDFs, you also need to install `poppler` (specific name of the package depends on the distro, but usually it's called something like `poppler-utils`).
|
|
53
|
+
|
|
54
|
+
### Windows
|
|
52
55
|
|
|
53
56
|
I don't know, but if someone manages, please let us know.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Running tests
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python -m pytest
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Recreate snapshot files:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python -m pytest --snapshot-update
|
|
70
|
+
```
|
|
@@ -12,13 +12,14 @@ Open a console and type:
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
|
|
15
|
+
brew install poppler
|
|
15
16
|
brew install python
|
|
16
17
|
brew install python-tk
|
|
17
18
|
brew install pipx
|
|
18
19
|
pipx install tinyprint
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
### Linux
|
|
22
23
|
|
|
23
24
|
Install python, and then just use pip:
|
|
24
25
|
|
|
@@ -26,6 +27,22 @@ Install python, and then just use pip:
|
|
|
26
27
|
pip3 install tinyprint
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
If you want to print PDFs, you also need to install `poppler` (specific name of the package depends on the distro, but usually it's called something like `poppler-utils`).
|
|
31
|
+
|
|
32
|
+
### Windows
|
|
30
33
|
|
|
31
34
|
I don't know, but if someone manages, please let us know.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Running tests
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
python -m pytest
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Recreate snapshot files:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
python -m pytest --snapshot-update
|
|
48
|
+
```
|
tinyprint-0.3.0/bin/t
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# vim: filetype=python
|
|
3
|
+
"""This is a convenience script to run tinyprint GUI on dev mode
|
|
4
|
+
|
|
5
|
+
(e.g. to start tinyprint with local, not-installed source)
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# Go up 1 level to reach tinyprint
|
|
9
|
+
import sys, os
|
|
10
|
+
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
|
|
11
|
+
|
|
12
|
+
from tinyprint import __main__
|
|
13
|
+
__main__.main()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{ sources ? import nix/sources.nix, pkgs ? import sources.nixpkgs {}}:
|
|
2
|
+
|
|
3
|
+
with pkgs;
|
|
4
|
+
with pkgs.python311Packages;
|
|
5
|
+
|
|
6
|
+
let
|
|
7
|
+
|
|
8
|
+
types-six = buildPythonPackage rec {
|
|
9
|
+
pname = "types-six";
|
|
10
|
+
version = "1.17.0.20241205";
|
|
11
|
+
format = "setuptools";
|
|
12
|
+
|
|
13
|
+
src = fetchPypi {
|
|
14
|
+
inherit version;
|
|
15
|
+
pname = "types_six";
|
|
16
|
+
hash = "sha256-H2YjR6jzsr8wUX1inYL1kUIN8pgReUsL84BOFNcW9uA=";
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
# Modules doesn't have tests
|
|
20
|
+
doCheck = false;
|
|
21
|
+
|
|
22
|
+
meta = with lib; {
|
|
23
|
+
description = "Typing stubs for six";
|
|
24
|
+
homepage = "https://github.com/python/typeshed";
|
|
25
|
+
license = licenses.asl20;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
args = {sources=sources; pkgs=pkgs; pythonPackages=pythonPackages;};
|
|
30
|
+
python-escpos = import ./nix/python-escpos/default.nix args;
|
|
31
|
+
|
|
32
|
+
in
|
|
33
|
+
|
|
34
|
+
buildPythonPackage rec {
|
|
35
|
+
name = "tinyprint";
|
|
36
|
+
src = ./.;
|
|
37
|
+
version = "0.1.0";
|
|
38
|
+
nativeCheckInputs = [ syrupy coverage pytest mypy types-pillow types-six ];
|
|
39
|
+
checkInputs = [ syrupy coverage pytest mypy types-pillow types-six ];
|
|
40
|
+
propagatedBuildInputs = [
|
|
41
|
+
python-escpos
|
|
42
|
+
tkinter
|
|
43
|
+
marko
|
|
44
|
+
dataclasses-json
|
|
45
|
+
pdf2image
|
|
46
|
+
platformdirs
|
|
47
|
+
];
|
|
48
|
+
checkPhase = ''
|
|
49
|
+
runHook preCheck
|
|
50
|
+
pytest
|
|
51
|
+
mypy -p tinyprint
|
|
52
|
+
runHook postCheck
|
|
53
|
+
'';
|
|
54
|
+
doCheck = true;
|
|
55
|
+
format = "pyproject";
|
|
56
|
+
}
|
|
57
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{ sources ? import ../sources.nix, pkgs ? import sources.nixpkgs {}, pythonPackages ? pkgs.python310Packages}:
|
|
2
|
+
|
|
3
|
+
with pkgs;
|
|
4
|
+
with pythonPackages;
|
|
5
|
+
|
|
6
|
+
buildPythonPackage rec {
|
|
7
|
+
name = "python-escpos";
|
|
8
|
+
pyproject = true;
|
|
9
|
+
src = fetchPypi {
|
|
10
|
+
pname = name;
|
|
11
|
+
version = "3.1";
|
|
12
|
+
sha256 = "sha256-MSQM3UOm0zccLFNvjewC8xv2julnzS7bJVqUz2cpWsA=";
|
|
13
|
+
};
|
|
14
|
+
prePatch = ''
|
|
15
|
+
export SETUPTOOLS_SCM_PRETEND_VERSION=3.1
|
|
16
|
+
'';
|
|
17
|
+
nativeBuildInputs = [
|
|
18
|
+
setuptools-scm
|
|
19
|
+
];
|
|
20
|
+
propagatedBuildInputs = [
|
|
21
|
+
# https://github.com/python-escpos/python-escpos/blob/99501cc2c1d21ea156b8b8b530ad66c9c9d00fe3/setup.cfg#L39-L48C5
|
|
22
|
+
pycups
|
|
23
|
+
pillow
|
|
24
|
+
pyserial
|
|
25
|
+
pyusb
|
|
26
|
+
qrcode
|
|
27
|
+
six
|
|
28
|
+
appdirs
|
|
29
|
+
pyyaml
|
|
30
|
+
argparse
|
|
31
|
+
argcomplete
|
|
32
|
+
setuptools
|
|
33
|
+
importlib-resources
|
|
34
|
+
python-barcode
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nixpkgs": {
|
|
3
|
+
"branch": "nixos-unstable",
|
|
4
|
+
"description": "Nix Packages collection",
|
|
5
|
+
"homepage": null,
|
|
6
|
+
"owner": "NixOS",
|
|
7
|
+
"repo": "nixpkgs",
|
|
8
|
+
"rev": "303bd8071377433a2d8f76e684ec773d70c5b642",
|
|
9
|
+
"sha256": "0qzxhnipsp48z9vx5xkdh74m6yny8k4ah6f47r1axk6lxhiwfdkj",
|
|
10
|
+
"type": "tarball",
|
|
11
|
+
"url": "https://github.com/NixOS/nixpkgs/archive/303bd8071377433a2d8f76e684ec773d70c5b642.tar.gz",
|
|
12
|
+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# This file has been generated by Niv.
|
|
2
|
+
|
|
3
|
+
let
|
|
4
|
+
|
|
5
|
+
#
|
|
6
|
+
# The fetchers. fetch_<type> fetches specs of type <type>.
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
fetch_file = pkgs: name: spec:
|
|
10
|
+
let
|
|
11
|
+
name' = sanitizeName name + "-src";
|
|
12
|
+
in
|
|
13
|
+
if spec.builtin or true then
|
|
14
|
+
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
|
|
15
|
+
else
|
|
16
|
+
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
|
|
17
|
+
|
|
18
|
+
fetch_tarball = pkgs: name: spec:
|
|
19
|
+
let
|
|
20
|
+
name' = sanitizeName name + "-src";
|
|
21
|
+
in
|
|
22
|
+
if spec.builtin or true then
|
|
23
|
+
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
|
|
24
|
+
else
|
|
25
|
+
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
|
|
26
|
+
|
|
27
|
+
fetch_git = name: spec:
|
|
28
|
+
let
|
|
29
|
+
ref =
|
|
30
|
+
if spec ? ref then spec.ref else
|
|
31
|
+
if spec ? branch then "refs/heads/${spec.branch}" else
|
|
32
|
+
if spec ? tag then "refs/tags/${spec.tag}" else
|
|
33
|
+
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
|
|
34
|
+
submodules = if spec ? submodules then spec.submodules else false;
|
|
35
|
+
submoduleArg =
|
|
36
|
+
let
|
|
37
|
+
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
|
|
38
|
+
emptyArgWithWarning =
|
|
39
|
+
if submodules == true
|
|
40
|
+
then
|
|
41
|
+
builtins.trace
|
|
42
|
+
(
|
|
43
|
+
"The niv input \"${name}\" uses submodules "
|
|
44
|
+
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
|
|
45
|
+
+ "does not support them"
|
|
46
|
+
)
|
|
47
|
+
{}
|
|
48
|
+
else {};
|
|
49
|
+
in
|
|
50
|
+
if nixSupportsSubmodules
|
|
51
|
+
then { inherit submodules; }
|
|
52
|
+
else emptyArgWithWarning;
|
|
53
|
+
in
|
|
54
|
+
builtins.fetchGit
|
|
55
|
+
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
|
|
56
|
+
|
|
57
|
+
fetch_local = spec: spec.path;
|
|
58
|
+
|
|
59
|
+
fetch_builtin-tarball = name: throw
|
|
60
|
+
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
|
|
61
|
+
$ niv modify ${name} -a type=tarball -a builtin=true'';
|
|
62
|
+
|
|
63
|
+
fetch_builtin-url = name: throw
|
|
64
|
+
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
|
|
65
|
+
$ niv modify ${name} -a type=file -a builtin=true'';
|
|
66
|
+
|
|
67
|
+
#
|
|
68
|
+
# Various helpers
|
|
69
|
+
#
|
|
70
|
+
|
|
71
|
+
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
|
|
72
|
+
sanitizeName = name:
|
|
73
|
+
(
|
|
74
|
+
concatMapStrings (s: if builtins.isList s then "-" else s)
|
|
75
|
+
(
|
|
76
|
+
builtins.split "[^[:alnum:]+._?=-]+"
|
|
77
|
+
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
# The set of packages used when specs are fetched using non-builtins.
|
|
82
|
+
mkPkgs = sources: system:
|
|
83
|
+
let
|
|
84
|
+
sourcesNixpkgs =
|
|
85
|
+
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
|
|
86
|
+
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
|
87
|
+
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
|
88
|
+
in
|
|
89
|
+
if builtins.hasAttr "nixpkgs" sources
|
|
90
|
+
then sourcesNixpkgs
|
|
91
|
+
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
|
92
|
+
import <nixpkgs> {}
|
|
93
|
+
else
|
|
94
|
+
abort
|
|
95
|
+
''
|
|
96
|
+
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
|
97
|
+
add a package called "nixpkgs" to your sources.json.
|
|
98
|
+
'';
|
|
99
|
+
|
|
100
|
+
# The actual fetching function.
|
|
101
|
+
fetch = pkgs: name: spec:
|
|
102
|
+
|
|
103
|
+
if ! builtins.hasAttr "type" spec then
|
|
104
|
+
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
|
|
105
|
+
else if spec.type == "file" then fetch_file pkgs name spec
|
|
106
|
+
else if spec.type == "tarball" then fetch_tarball pkgs name spec
|
|
107
|
+
else if spec.type == "git" then fetch_git name spec
|
|
108
|
+
else if spec.type == "local" then fetch_local spec
|
|
109
|
+
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
|
|
110
|
+
else if spec.type == "builtin-url" then fetch_builtin-url name
|
|
111
|
+
else
|
|
112
|
+
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
|
|
113
|
+
|
|
114
|
+
# If the environment variable NIV_OVERRIDE_${name} is set, then use
|
|
115
|
+
# the path directly as opposed to the fetched source.
|
|
116
|
+
replace = name: drv:
|
|
117
|
+
let
|
|
118
|
+
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
|
|
119
|
+
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
|
|
120
|
+
in
|
|
121
|
+
if ersatz == "" then drv else
|
|
122
|
+
# this turns the string into an actual Nix path (for both absolute and
|
|
123
|
+
# relative paths)
|
|
124
|
+
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
|
|
125
|
+
|
|
126
|
+
# Ports of functions for older nix versions
|
|
127
|
+
|
|
128
|
+
# a Nix version of mapAttrs if the built-in doesn't exist
|
|
129
|
+
mapAttrs = builtins.mapAttrs or (
|
|
130
|
+
f: set: with builtins;
|
|
131
|
+
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
|
|
135
|
+
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
|
|
136
|
+
|
|
137
|
+
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
|
|
138
|
+
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
|
|
139
|
+
|
|
140
|
+
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
|
|
141
|
+
stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
|
|
142
|
+
concatMapStrings = f: list: concatStrings (map f list);
|
|
143
|
+
concatStrings = builtins.concatStringsSep "";
|
|
144
|
+
|
|
145
|
+
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
|
|
146
|
+
optionalAttrs = cond: as: if cond then as else {};
|
|
147
|
+
|
|
148
|
+
# fetchTarball version that is compatible between all the versions of Nix
|
|
149
|
+
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
|
|
150
|
+
let
|
|
151
|
+
inherit (builtins) lessThan nixVersion fetchTarball;
|
|
152
|
+
in
|
|
153
|
+
if lessThan nixVersion "1.12" then
|
|
154
|
+
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
|
155
|
+
else
|
|
156
|
+
fetchTarball attrs;
|
|
157
|
+
|
|
158
|
+
# fetchurl version that is compatible between all the versions of Nix
|
|
159
|
+
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
|
|
160
|
+
let
|
|
161
|
+
inherit (builtins) lessThan nixVersion fetchurl;
|
|
162
|
+
in
|
|
163
|
+
if lessThan nixVersion "1.12" then
|
|
164
|
+
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
|
|
165
|
+
else
|
|
166
|
+
fetchurl attrs;
|
|
167
|
+
|
|
168
|
+
# Create the final "sources" from the config
|
|
169
|
+
mkSources = config:
|
|
170
|
+
mapAttrs (
|
|
171
|
+
name: spec:
|
|
172
|
+
if builtins.hasAttr "outPath" spec
|
|
173
|
+
then abort
|
|
174
|
+
"The values in sources.json should not have an 'outPath' attribute"
|
|
175
|
+
else
|
|
176
|
+
spec // { outPath = replace name (fetch config.pkgs name spec); }
|
|
177
|
+
) config.sources;
|
|
178
|
+
|
|
179
|
+
# The "config" used by the fetchers
|
|
180
|
+
mkConfig =
|
|
181
|
+
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
|
|
182
|
+
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
|
|
183
|
+
, system ? builtins.currentSystem
|
|
184
|
+
, pkgs ? mkPkgs sources system
|
|
185
|
+
}: rec {
|
|
186
|
+
# The sources, i.e. the attribute set of spec name to spec
|
|
187
|
+
inherit sources;
|
|
188
|
+
|
|
189
|
+
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
|
|
190
|
+
inherit pkgs;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
in
|
|
194
|
+
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{ sources ? import nix/sources.nix, pkgs ? import sources.nixpkgs {}}:
|
|
2
|
+
|
|
3
|
+
let
|
|
4
|
+
|
|
5
|
+
tinyprint = import ./default.nix {};
|
|
6
|
+
|
|
7
|
+
mypython = pkgs.python311.buildEnv.override {
|
|
8
|
+
extraLibs = with pkgs.python311Packages; [
|
|
9
|
+
# Needed for pypi upload
|
|
10
|
+
twine
|
|
11
|
+
wheel
|
|
12
|
+
setuptools
|
|
13
|
+
build
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
in
|
|
19
|
+
|
|
20
|
+
pkgs.mkShell {
|
|
21
|
+
buildInputs = with pkgs; [
|
|
22
|
+
mypython
|
|
23
|
+
];
|
|
24
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "tinyprint"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.0"
|
|
4
4
|
authors = [
|
|
5
5
|
{name = "Levin Eric Zimmermann", email = "levin.eric.zimmermann@posteo.com"},
|
|
6
6
|
]
|
|
@@ -10,8 +10,9 @@ readme = "README.md"
|
|
|
10
10
|
dependencies = [
|
|
11
11
|
'python-escpos[serial,usb]>=3.1',
|
|
12
12
|
'dataclasses-json>=0.6.0',
|
|
13
|
-
'marko
|
|
13
|
+
'marko==2.1.2',
|
|
14
14
|
'pdf2image>=1.17.0',
|
|
15
|
+
'platformdirs>=4.5.0',
|
|
15
16
|
]
|
|
16
17
|
|
|
17
18
|
[project.optional-dependencies]
|
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-horizontal-copies_1-cut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-horizontal-copies_1-nocut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-horizontal-copies_2-cut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-horizontal-copies_2-nocut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-vertical-copies_1-cut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-vertical-copies_1-nocut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-vertical-copies_2-cut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[image-vertical-copies_2-nocut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-horizontal-copies_1-cut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-horizontal-copies_1-nocut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-horizontal-copies_2-cut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-horizontal-copies_2-nocut].raw
ADDED
|
Binary file
|
tinyprint-0.3.0/tests/__snapshots__/test_integration/test_print[pdf-vertical-copies_1-cut].raw
ADDED
|
Binary file
|