From 708113a514924391343a90fd52f36990fc4ac20b Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sun, 29 Dec 2019 01:14:00 -0800 Subject: [PATCH] Windows: Remove Program Files cache from ocrmypdf.exec @lru_cache doesn't work here, so let's just remove it. --- azure-pipelines.yml | 7 +++---- src/ocrmypdf/exec/__init__.py | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 06d9e14d..6d92fb39 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,15 +34,14 @@ stages: displayName: "Install system packages" - pwsh: | refreshenv - pip install --upgrade pip wheel - pip install -r requirements/main.txt -r requirements/test.txt . - tesseract --version + python -m pip install --upgrade pip wheel + python -m pip install -r requirements/main.txt -r requirements/test.txt . displayName: "Install Python packages" - pwsh: | refreshenv $env:pathext += ';.py' # -n auto helps Windows - python3 -m pytest -n auto --junitxml=test.xml --cov=ocrmypdf --cov-report=xml + python -m pytest -n auto --junitxml=test.xml --cov=ocrmypdf --cov-report=xml displayName: "Test" - task: PublishTestResults@2 inputs: diff --git a/src/ocrmypdf/exec/__init__.py b/src/ocrmypdf/exec/__init__.py index 00136ec6..2eb6cd88 100644 --- a/src/ocrmypdf/exec/__init__.py +++ b/src/ocrmypdf/exec/__init__.py @@ -122,7 +122,6 @@ def get_version(program, *, version_arg='--version', regex=r'(\d+(\.\d+)*)', env return version -@lru_cache(maxsize=1) def shim_paths_with_program_files(env=None): if not env: env = os.environ @@ -134,7 +133,7 @@ def shim_paths_with_program_files(env=None): for dirname in os.listdir(program_files): if dirname.lower() == 'tesseract-ocr': paths.append(os.path.join(program_files, dirname)) - if dirname.lower() == 'gs': + elif dirname.lower() == 'gs': try: latest_gs = max( os.listdir(os.path.join(program_files, dirname)),