mirror of
https://github.com/SickGear/SickGear.git
synced 2024-11-15 01:15:05 +00:00
Fix updating with running virtualenv.
This commit is contained in:
parent
9f24e417d6
commit
39f0539439
5 changed files with 23 additions and 6 deletions
|
@ -1,4 +1,9 @@
|
|||
### 3.27.3 (2023-02-15 02:00:00 UTC)
|
||||
### 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)
|
||||
|
||||
* Fix reading legacy autoProcessTV.cfg
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@
|
|||
#end for
|
||||
</tbody>
|
||||
</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>
|
||||
</span>
|
||||
|
|
|
@ -1734,3 +1734,13 @@ def iterate_chunk(lst, n):
|
|||
"""
|
||||
for i in moves.range(0, len(lst), 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
|
||||
|
|
|
@ -16,7 +16,7 @@ import os
|
|||
import re
|
||||
|
||||
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 six import iteritems, PY2
|
||||
|
@ -105,7 +105,7 @@ def initial_requirements():
|
|||
run_pip(['uninstall', '-r', 'recommended-remove.txt'])
|
||||
raise ValueError
|
||||
except (BaseException, ImportError):
|
||||
run_pip(['install', '-U', '--user', '-r', 'requirements.txt'])
|
||||
run_pip(['install', '-U'] + (['--user'], [])[is_virtualenv()] + ['-r', 'requirements.txt'])
|
||||
module = 'Cheetah'
|
||||
try:
|
||||
locals()[module] = __import__(module)
|
||||
|
@ -327,7 +327,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
|
||||
output, err, exit_status = run_pip(['install', '-U']
|
||||
+ ([], ['--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/'
|
||||
'v4/projects/279215/packages/pypi/simple'])
|
||||
pip_version = None
|
||||
|
|
|
@ -41,7 +41,7 @@ import exceptions_helper
|
|||
import encodingKludge as ek
|
||||
from json_helper import json_dumps, json_loads
|
||||
import sg_helpers
|
||||
from sg_helpers import remove_file, scantree
|
||||
from sg_helpers import remove_file, scantree, is_virtualenv
|
||||
|
||||
import sickgear
|
||||
from . import classes, clients, config, db, helpers, history, image_cache, logger, name_cache, naming, \
|
||||
|
@ -7937,6 +7937,7 @@ class ConfigGeneral(Config):
|
|||
t.request_host = helpers.xhtml_escape(self.request.host_name, False)
|
||||
api_keys = '|||'.join([':::'.join(a) for a in sickgear.API_KEYS])
|
||||
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:
|
||||
# noinspection PyProtectedMember
|
||||
sickgear.update_software_scheduler.action.updater._find_installed_version()
|
||||
|
|
Loading…
Reference in a new issue