2018-08-04 12:37:38 +00:00
|
|
|
Running img2pdf from source
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
img2pdf can be run directly from the cloned git repository:
|
|
|
|
|
|
|
|
$ python3 src/img2pdf.py img.jpg -o out.pdf
|
|
|
|
|
|
|
|
Running the testsuite
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
$ python3 setup.py test
|
2019-01-07 09:41:38 +00:00
|
|
|
$ ./test.sh
|
2018-08-04 12:37:38 +00:00
|
|
|
|
2019-01-07 09:41:38 +00:00
|
|
|
Fixing the setup.py testsuite
|
|
|
|
-----------------------------
|
2018-08-04 12:37:38 +00:00
|
|
|
|
|
|
|
Sometimes your changes will break the testsuite. The testsuite works by
|
|
|
|
comparing the images found in `src/tests/input` with the corresponding PDF
|
|
|
|
documents in `src/tests/output`. The filename of the output file will be the
|
|
|
|
same name the input has with the `.pdf` suffix appended to it. To generate the
|
|
|
|
files in the `src/tests/output` directory via the command line, run:
|
|
|
|
|
|
|
|
$ src/img2pdf.py --producer="" --nodate src/tests/input/normal.jpg -o src/tests/output/normal.jpg.pdf
|
|
|
|
|
|
|
|
This makes it easier to spot where the differences are and how to fix the
|
|
|
|
issue.
|
|
|
|
|
2019-01-07 09:41:38 +00:00
|
|
|
Fixing the test.sh testsuite
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
If your changes break test.sh, then the script will abort immediately and tell
|
|
|
|
you where it left the temporary files for you to inspect. You can also try
|
|
|
|
running the script like this for maximum verbosity:
|
|
|
|
|
|
|
|
$ sh -x ./test.sh
|
|
|
|
|
2018-08-04 12:37:38 +00:00
|
|
|
Making a new release
|
|
|
|
--------------------
|
|
|
|
|
2020-04-05 10:12:30 +00:00
|
|
|
- CHANGES.rst: Add a new entry
|
|
|
|
- setup.py: Bump VERSION
|
|
|
|
- src/img2pdf.py: Bump __version__
|
2018-08-04 12:37:38 +00:00
|
|
|
- Commit:
|
|
|
|
|
2020-04-05 10:12:30 +00:00
|
|
|
$ git add CHANGES.rst setup.py src/img2pdf.py
|
2018-08-04 12:37:38 +00:00
|
|
|
$ git commit -m "release version X.Y.Z"
|
|
|
|
|
|
|
|
- Add git tag:
|
|
|
|
|
2020-04-05 13:10:31 +00:00
|
|
|
$ git tag X.Y.Z -m X.Y.Z
|
2018-08-04 12:37:38 +00:00
|
|
|
|
|
|
|
- Build and upload to pypi:
|
|
|
|
|
2020-04-05 10:12:30 +00:00
|
|
|
$ rm dist/*
|
2019-01-07 09:41:38 +00:00
|
|
|
$ python3 setup.py sdist
|
2018-08-04 12:37:38 +00:00
|
|
|
$ twine upload --sign dist/*
|