Add Python 3.7 support

This commit is contained in:
James R. Barlow
2018-06-28 13:57:45 -07:00
parent bf214eecb3
commit b0eacd6586
5 changed files with 20 additions and 12 deletions
+6 -2
View File
@@ -36,11 +36,15 @@ matrix:
- os: linux - os: linux
sudo: required sudo: required
language: python language: python
python: 3.5 python: "3.5"
- os: linux - os: linux
sudo: required sudo: required
language: python language: python
python: 3.6 python: "3.6"
- os: linux
sudo: required
language: python
python: "3.7-dev"
- os: osx - os: osx
osx_image: xcode8 osx_image: xcode8
language: generic language: generic
+7 -9
View File
@@ -4,10 +4,10 @@ OCRmyPDF
.. image:: https://travis-ci.org/jbarlow83/OCRmyPDF.svg?branch=master .. image:: https://travis-ci.org/jbarlow83/OCRmyPDF.svg?branch=master
:target: https://travis-ci.org/jbarlow83/OCRmyPDF :target: https://travis-ci.org/jbarlow83/OCRmyPDF
.. image:: https://img.shields.io/pypi/v/ocrmypdf.svg .. image:: https://img.shields.io/pypi/v/ocrmypdf.svg
:target: https://pypi.org/project/ocrmypdf/ :target: https://pypi.org/project/ocrmypdf/
.. image:: https://img.shields.io/homebrew/v/ocrmypdf.svg .. image:: https://img.shields.io/homebrew/v/ocrmypdf.svg
:alt: homebrew :alt: homebrew
:target: http://brewformulas.org/Ocrmypdf :target: http://brewformulas.org/Ocrmypdf
@@ -53,7 +53,7 @@ Motivation
I searched the web for a free command line tool to OCR PDF files on I searched the web for a free command line tool to OCR PDF files on
Linux/UNIX: I found many, but none of them were really satisfying. Linux/UNIX: I found many, but none of them were really satisfying.
- Either they produced PDF files with misplaced text under the image (making copy/paste impossible) - Either they produced PDF files with misplaced text under the image (making copy/paste impossible)
- Or they did not handle accents and multilingual characters - Or they did not handle accents and multilingual characters
- Or they changed the resolution of the embedded images - Or they changed the resolution of the embedded images
- Or they generated ridiculously large PDF files - Or they generated ridiculously large PDF files
@@ -62,7 +62,7 @@ Linux/UNIX: I found many, but none of them were really satisfying.
- On top of that none of them produced PDF/A files (format dedicated for long time storage) - On top of that none of them produced PDF/A files (format dedicated for long time storage)
...so I decided to develop my own tool (using various existing scripts ...so I decided to develop my own tool (using various existing scripts
as an inspiration). as an inspiration).
Installation Installation
------------ ------------
@@ -96,7 +96,7 @@ you can often find packages that provide language packs:
# Debian/Ubuntu users # Debian/Ubuntu users
apt-get install tesseract-ocr-chi-sim # Example: Install Chinese Simplified language back apt-get install tesseract-ocr-chi-sim # Example: Install Chinese Simplified language back
You can then pass the ``-l LANG`` argument to OCRmyPDF to give a hint as to what languages it should search for. Multiple You can then pass the ``-l LANG`` argument to OCRmyPDF to give a hint as to what languages it should search for. Multiple
languages can be requested. languages can be requested.
@@ -125,9 +125,7 @@ If you detect an issue, please:
Requirements Requirements
------------ ------------
Runs on CPython 3.6, and requires external program installations of Ghostscript, Tesseract OCR, QPDF, and Leptonica. ocrmypdf is pure Python, but uses CFFI to portably generate library bindings. Runs on CPython 3.5, 3.6 and 3.7. Requires external program installations of Ghostscript, Tesseract OCR, QPDF, and Leptonica. ocrmypdf is pure Python, but uses CFFI to portably generate library bindings.
Python 3.5 is also supported.
Press & Media Press & Media
------------- -------------
@@ -141,7 +139,7 @@ Press & Media
License License
------- -------
The OCRmyPDF software is licensed under the GNU GPLv3. Certain files are covered by other licenses, as noted in their source files. The OCRmyPDF software is licensed under the GNU GPLv3. Certain files are covered by other licenses, as noted in their source files.
The license for each test file varies, and is noted in tests/resources/README.rst. The documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA 4.0). The license for each test file varies, and is noted in tests/resources/README.rst. The documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA 4.0).
+1 -1
View File
@@ -168,7 +168,7 @@ Install or upgrade the required Homebrew packages, if any are missing:
brew install libxml2 libffi leptonica brew install libxml2 libffi leptonica
brew install unpaper # optional brew install unpaper # optional
Python 3.5 and 3.6 are supported. Python 3.5, 3.6 and 3.7 are supported.
Install the required Tesseract OCR engine with the language packs you plan to use: Install the required Tesseract OCR engine with the language packs you plan to use:
+1
View File
@@ -221,6 +221,7 @@ setup(
classifiers=[ classifiers=[
"Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Development Status :: 5 - Production/Stable", "Development Status :: 5 - Production/Stable",
"Environment :: Console", "Environment :: Console",
"Intended Audience :: End Users/Desktop", "Intended Audience :: End Users/Desktop",
+5
View File
@@ -40,6 +40,11 @@ import codecs
def verify_python3_env(): def verify_python3_env():
"""Ensures that the environment is good for unicode on Python 3.""" """Ensures that the environment is good for unicode on Python 3."""
# PEP 538 changes in Python 3.7 should make this wrangling unnecessary
if sys.version_info[0:3] >= (3, 7, 0):
return
try: try:
import locale import locale
fs_enc = codecs.lookup(locale.getpreferredencoding()).name fs_enc = codecs.lookup(locale.getpreferredencoding()).name