Merge pull request #4682 from PySimpleGUI/Dev-latest
Changed the install from GitHub using a new technique
This commit is contained in:
commit
ee0b8d6635
|
@ -20980,14 +20980,16 @@ def _copy_files_from_github():
|
||||||
"""Update the local PySimpleGUI installation from Github"""
|
"""Update the local PySimpleGUI installation from Github"""
|
||||||
|
|
||||||
github_url = 'https://raw.githubusercontent.com/PySimpleGUI/PySimpleGUI/master/'
|
github_url = 'https://raw.githubusercontent.com/PySimpleGUI/PySimpleGUI/master/'
|
||||||
files = ["PySimpleGUI.py", "setup.py"]
|
#files = ["PySimpleGUI.py", "setup.py"]
|
||||||
|
files = ["PySimpleGUI.py"]
|
||||||
|
|
||||||
# add a temp directory
|
# add a temp directory
|
||||||
temp_dir = tempfile.TemporaryDirectory()
|
temp_dir = tempfile.TemporaryDirectory()
|
||||||
path = temp_dir.name
|
psg_dir = os.path.join(temp_dir.name, 'PySimpleGUI')
|
||||||
|
path = psg_dir
|
||||||
|
|
||||||
|
|
||||||
# os.mkdir('temp')
|
os.mkdir(path)
|
||||||
# path = os.path.abspath('temp')
|
# path = os.path.abspath('temp')
|
||||||
|
|
||||||
# download the files
|
# download the files
|
||||||
|
@ -21007,14 +21009,20 @@ def _copy_files_from_github():
|
||||||
if match:
|
if match:
|
||||||
package_version = match.group(1)
|
package_version = match.group(1)
|
||||||
|
|
||||||
# update the setup.py file
|
# create a setup.py file from scratch
|
||||||
with open(os.path.join(path, files[1]), encoding='utf-8') as f:
|
setup_text = ''.join([
|
||||||
text_data = f.read()
|
"import setuptools\n",
|
||||||
|
"setuptools.setup(",
|
||||||
with open(os.path.join(path, files[1]), 'w', encoding='utf-8') as f:
|
"name='PySimpleGUI',",
|
||||||
edit1 = re.sub("version.+", 'version="' + package_version + '",', text_data)
|
"author='PySimpleGUI',"
|
||||||
edit2 = re.sub("packages.+", r'packages=["."],', edit1)
|
"author_email='PySimpleGUI@PySimpleGUI.org',",
|
||||||
f.write(edit2)
|
"description='Unreleased Development Version',",
|
||||||
|
"url='https://github.com/PySimpleGUI/PySimpleGUI',"
|
||||||
|
"packages=setuptools.find_packages(),",
|
||||||
|
"version='", package_version, "')"
|
||||||
|
])
|
||||||
|
with open(os.path.join(temp_dir.name, 'setup.py'), 'w', encoding='utf-8') as f:
|
||||||
|
f.write(setup_text)
|
||||||
|
|
||||||
# create an __init__.py file
|
# create an __init__.py file
|
||||||
with open(os.path.join(path, '__init__.py'), 'w', encoding='utf-8') as f:
|
with open(os.path.join(path, '__init__.py'), 'w', encoding='utf-8') as f:
|
||||||
|
@ -21023,7 +21031,7 @@ def _copy_files_from_github():
|
||||||
# install the pysimplegui package from local dist
|
# install the pysimplegui package from local dist
|
||||||
# https://pip.pypa.io/en/stable/user_guide/?highlight=subprocess#using-pip-from-your-program
|
# https://pip.pypa.io/en/stable/user_guide/?highlight=subprocess#using-pip-from-your-program
|
||||||
# subprocess.check_call([sys.executable, '-m', 'pip', 'install', path])
|
# subprocess.check_call([sys.executable, '-m', 'pip', 'install', path])
|
||||||
|
python_command = execute_py_get_interpreter()
|
||||||
|
|
||||||
layout = [[Text('Pip Upgrade Progress')],
|
layout = [[Text('Pip Upgrade Progress')],
|
||||||
[Multiline(s=(90,30), k='-MLINE-', reroute_cprint=True, write_only=True)],
|
[Multiline(s=(90,30), k='-MLINE-', reroute_cprint=True, write_only=True)],
|
||||||
|
@ -21031,14 +21039,14 @@ def _copy_files_from_github():
|
||||||
|
|
||||||
window = Window('Pip Upgrade', layout, finalize=True, keep_on_top=True, modal=True, disable_close=True)
|
window = Window('Pip Upgrade', layout, finalize=True, keep_on_top=True, modal=True, disable_close=True)
|
||||||
|
|
||||||
python_command = execute_py_get_interpreter()
|
cprint('The value of sys.executable = ', sys.executable, c='white on red')
|
||||||
|
|
||||||
if not python_command:
|
if not python_command:
|
||||||
python_command = sys.executable
|
python_command = sys.executable
|
||||||
|
|
||||||
|
cprint('Installing with the Python interpreter =', python_command, c='white on purple')
|
||||||
|
|
||||||
cprint('The python command in sys.executable = ', sys.executable, c='white on red')
|
sp = execute_command_subprocess(python_command, '-m pip install --upgrade --no-cache-dir', temp_dir.name, pipe_output=True)
|
||||||
sp = execute_command_subprocess(python_command, '-m pip install --upgrade --no-cache-dir', path, pipe_output=True)
|
|
||||||
|
|
||||||
|
|
||||||
threading.Thread(target=_the_github_upgrade_thread, args=(window, sp), daemon=True).start()
|
threading.Thread(target=_the_github_upgrade_thread, args=(window, sp), daemon=True).start()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue