Skip to content

Commit

Permalink
feat: fix python installation
Browse files Browse the repository at this point in the history
for systems where same python version (major.minor) is already installed
to avoid python-apt missing error messages because of overridden python
executable
  • Loading branch information
stevenengland committed Aug 4, 2023
1 parent 5be82a2 commit 95b79dc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The following sections are devided into:
| `paperless_ngx_dependency_install_tmp_dir` | /tmp/ | Directory for temporary dependency installation files |
| `paperless_ngx_dir_force_permission_exclude` | [] | Which directories should be skipped from permission check/setting. See [docs](docs/DIRECTORY_PERMISSION_CHECK.md). |
| `paperless_ngx_dir_installation` | /opt/paperless-ngx | The directory where paperless-ngx static installation files are written to. |
| `paperless_ngx_dir_python` | /opt/python/{{ paperless_ngx_python_version_short }} | The directory where python binaries are compiled to. |
| `paperless_ngx_dir_runtime_data` | /var/lib/paperless-ngx | The directory where the runtime data will be stored. |
| `paperless_ngx_dir_virtualenv` | "{{ paperless_ngx_dir_installation }}/.venv" | The directory for the needed python venv. |
| `paperless_ngx_jbig2enc_enabled` | true | Whether to install and use jbig2enc for OCRmyPDF. |
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ paperless_ngx_db_type: sqlite # or postgresql
## Directories
paperless_ngx_dir_force_permission_exclude: []
paperless_ngx_dir_installation: /opt/paperless-ngx
paperless_ngx_dir_python: /opt/python/{{ paperless_ngx_python_version_short }}
paperless_ngx_dir_runtime_data: /var/lib/paperless-ngx
paperless_ngx_dir_virtualenv: "{{ paperless_ngx_dir_installation }}/.venv"
## jbig2encode
Expand Down
2 changes: 1 addition & 1 deletion tasks/base_dependencies/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
delay: 60

- name: Run configure for python
ansible.builtin.command: ./configure --prefix=/usr --enable-optimizations --with-ensurepip=install
ansible.builtin.command: ./configure --prefix={{ paperless_ngx_dir_python }} --enable-optimizations --with-ensurepip=install
args:
chdir: "{{ _python_archive_dir.path }}"
changed_when: true
Expand Down
6 changes: 3 additions & 3 deletions tasks/paperless_ngx/venv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
ansible.builtin.pip:
name: virtualenv

Check warning on line 8 in tasks/paperless_ngx/venv.yml

View workflow job for this annotation

GitHub Actions / linting

jinja[spacing]

Jinja2 spacing could be improved: {{ paperless_ngx_dir_python}}/bin/pip{{ paperless_ngx_python_version_short }} -> {{ paperless_ngx_dir_python }}/bin/pip{{ paperless_ngx_python_version_short }}
extra_args: --upgrade --user
executable: /usr/bin/pip{{ paperless_ngx_python_version_short }}
executable: "{{ paperless_ngx_dir_python}}/bin/pip{{ paperless_ngx_python_version_short }}"

- name: Install latest pip
become: true
become_user: "{{ paperless_ngx_system_user }}"
ansible.builtin.pip:
name: pip

Check warning on line 16 in tasks/paperless_ngx/venv.yml

View workflow job for this annotation

GitHub Actions / linting

jinja[spacing]

Jinja2 spacing could be improved: {{ paperless_ngx_dir_python}}/bin/python{{ paperless_ngx_python_version_short }} -> {{ paperless_ngx_dir_python }}/bin/python{{ paperless_ngx_python_version_short }}
virtualenv: "{{ paperless_ngx_dir_virtualenv }}"
virtualenv_python: /usr/bin/python{{ paperless_ngx_python_version_short }}
virtualenv_python: "{{ paperless_ngx_dir_python}}/bin/python{{ paperless_ngx_python_version_short }}"
virtualenv_command: python{{ paperless_ngx_python_version_short }} -m virtualenv
extra_args: --upgrade

Expand All @@ -25,7 +25,7 @@
ansible.builtin.pip:
requirements: "{{ paperless_ngx_dir_installation }}/requirements.txt"

Check warning on line 26 in tasks/paperless_ngx/venv.yml

View workflow job for this annotation

GitHub Actions / linting

jinja[spacing]

Jinja2 spacing could be improved: {{ paperless_ngx_dir_python}}/bin/python{{ paperless_ngx_python_version_short }} -> {{ paperless_ngx_dir_python }}/bin/python{{ paperless_ngx_python_version_short }}
virtualenv: "{{ paperless_ngx_dir_virtualenv }}"
virtualenv_python: /usr/bin/python{{ paperless_ngx_python_version_short }}
virtualenv_python: "{{ paperless_ngx_dir_python}}/bin/python{{ paperless_ngx_python_version_short }}"
extra_args: --upgrade
register: _install_python_requirements
until: 'not "ReadTimeoutError" in _install_python_requirements.msg | default("")'
Expand Down

0 comments on commit 95b79dc

Please sign in to comment.