Merge branch 'main' into dev

This commit is contained in:
JackDandy 2023-02-15 14:03:29 +00:00
commit dac9f2cdff
5 changed files with 22 additions and 5 deletions

View file

@ -4,6 +4,11 @@
* Change requirements for pure py3 * Change requirements for pure py3
### 3.27.4 (2023-02-15 13:30:00 UTC)
* Fix updating with running virtualenv
### 3.27.3 (2023-02-15 02:00:00 UTC) ### 3.27.3 (2023-02-15 02:00:00 UTC)
* Fix reading legacy autoProcessTV.cfg * Fix reading legacy autoProcessTV.cfg

View file

@ -272,7 +272,7 @@
#end for #end for
</tbody> </tbody>
</table> </table>
<p class="extras">the above info may help with packages that don't update internally<br>manual installation tip: <code>python -m pip install -U --user package</code></p> <p class="extras">the above info may help with packages that don't update internally<br>manual installation tip: <code>python -m pip install -U #echo $pip_user_arg#package</code></p>
</div> </div>
</div> </div>
</span> </span>

View file

@ -1733,3 +1733,13 @@ def iterate_chunk(lst, n):
""" """
for i in moves.range(0, len(lst), n): for i in moves.range(0, len(lst), n):
yield lst[i:i + n] yield lst[i:i + n]
def is_virtualenv():
# type: (...) -> bool
"""
:return: True if virtualenv Python environment is detected
"""
"""Get base/real prefix, or `sys.prefix` if there is none."""
get_base_prefix_compat = getattr(sys, 'base_prefix', None) or getattr(sys, 'real_prefix', None) or sys.prefix
return get_base_prefix_compat != sys.prefix

View file

@ -8,7 +8,7 @@ import os
import re import re
from json_helper import json_loads from json_helper import json_loads
from sg_helpers import cmdline_runner from sg_helpers import cmdline_runner, is_virtualenv
from _23 import filter_list, ordered_dict from _23 import filter_list, ordered_dict
from six import iteritems, PY2 from six import iteritems, PY2
@ -97,7 +97,7 @@ def initial_requirements():
run_pip(['uninstall', '-r', 'recommended-remove.txt']) run_pip(['uninstall', '-r', 'recommended-remove.txt'])
raise ValueError raise ValueError
except (BaseException, ImportError): except (BaseException, ImportError):
run_pip(['install', '-U', '--user', '-r', 'requirements.txt']) run_pip(['install', '-U'] + (['--user'], [])[is_virtualenv()] + ['-r', 'requirements.txt'])
module = 'Cheetah' module = 'Cheetah'
try: try:
locals()[module] = __import__(module) locals()[module] = __import__(module)
@ -319,7 +319,8 @@ def pip_update(loading_msg, updates_todo, data_dir):
# exclude Cheetah3 to prevent `No matching distro found` and fallback to its legacy setup.py installer # exclude Cheetah3 to prevent `No matching distro found` and fallback to its legacy setup.py installer
output, err, exit_status = run_pip(['install', '-U'] output, err, exit_status = run_pip(['install', '-U']
+ ([], ['--only-binary=:all:'])[cur_project_name not in ('Cheetah3', )] + ([], ['--only-binary=:all:'])[cur_project_name not in ('Cheetah3', )]
+ ['--user', '-r', piper_path, '--extra-index-url', + (['--user'], [])[is_virtualenv()]
+ ['-r', piper_path, '--extra-index-url',
'https://gitlab+deploy-token-1599941:UNupqjtDab_zxNzvP2gA@gitlab.com/api/' 'https://gitlab+deploy-token-1599941:UNupqjtDab_zxNzvP2gA@gitlab.com/api/'
'v4/projects/279215/packages/pypi/simple']) 'v4/projects/279215/packages/pypi/simple'])
pip_version = None pip_version = None

View file

@ -39,7 +39,7 @@ from exceptions_helper import ex, MultipleShowObjectsException
import exceptions_helper import exceptions_helper
from json_helper import json_dumps, json_loads from json_helper import json_dumps, json_loads
import sg_helpers import sg_helpers
from sg_helpers import remove_file, scantree from sg_helpers import remove_file, scantree, is_virtualenv
import sickgear import sickgear
from . import classes, clients, config, db, helpers, history, image_cache, logger, name_cache, naming, \ from . import classes, clients, config, db, helpers, history, image_cache, logger, name_cache, naming, \
@ -7934,6 +7934,7 @@ class ConfigGeneral(Config):
t.request_host = helpers.xhtml_escape(self.request.host_name, False) t.request_host = helpers.xhtml_escape(self.request.host_name, False)
api_keys = '|||'.join([':::'.join(a) for a in sickgear.API_KEYS]) api_keys = '|||'.join([':::'.join(a) for a in sickgear.API_KEYS])
t.api_keys = api_keys and sickgear.API_KEYS or [] t.api_keys = api_keys and sickgear.API_KEYS or []
t.pip_user_arg = ('--user ', '')[is_virtualenv()]
if 'git' == sickgear.update_software_scheduler.action.install_type: if 'git' == sickgear.update_software_scheduler.action.install_type:
# noinspection PyProtectedMember # noinspection PyProtectedMember
sickgear.update_software_scheduler.action.updater._find_installed_version() sickgear.update_software_scheduler.action.updater._find_installed_version()