Skip to content

Commit 1e1f834

Browse files
committed
fixing "pyradio -R" on Windows
1 parent f73a9c0 commit 1e1f834

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

pyradio/install.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,10 @@ def remove_pyradio(self, win_open_dir=False):
492492
print('Please report this at http://github.com/coderholic/pyradio/issues\n')
493493
sys.exit(1)
494494

495-
def update_or_uninstall_on_windows(self, mode='update'):
495+
def update_or_uninstall_on_windows(self, mode='update', from_pyradio=False):
496+
# Params:
497+
# mode: the type of zip file to download
498+
# from_pyradio: True if executed by "pyradio -d"
496499
params = ('', '--sng-master', '--sng-devel', '--devel', '--master')
497500
isRunning()
498501
''' Creates BAT file to update or uninstall PyRadio on Windows'''
@@ -506,10 +509,17 @@ def update_or_uninstall_on_windows(self, mode='update'):
506509
else:
507510
bat = os.path.join(self._dir, 'uninstall.bat')
508511
os.system('CLS')
509-
# PyRadioUpdateOnWindows.print_uninstall_bat_created()
512+
if from_pyradio:
513+
PyRadioUpdateOnWindows.print_uninstall_bat_created()
510514

511515
if self._package == 0:
512516
if self.ZIP_DIR[0].endswith('-'):
517+
try:
518+
if VERSION == '':
519+
VERSION = get_github_tag()
520+
except:
521+
VERSION = get_github_tag()
522+
# print('VERSION = "{}"'.format(VERSION))
513523
self.ZIP_URL[0] = self.ZIP_URL[0] + VERSION + '.zip'
514524
self.ZIP_DIR[0] += VERSION
515525
try:
@@ -538,6 +548,9 @@ def update_or_uninstall_on_windows(self, mode='update'):
538548
else:
539549
b.write(self._python_exec.python + ' uninstall.py --do-uninstall ' + params[self._package] + '\n')
540550
b.write('if %ERRORLEVEL% == 1 GOTO downloaderror\n')
551+
# print('self._dir = "{}"'.format(self._dir))
552+
# print('self._package = "{}"'.format(self._package))
553+
# print('self.ZIP_DIR = "{}"'.format(self.ZIP_DIR))
541554
b.write('cd "' + os.path.join(self._dir, self.ZIP_DIR[self._package]) + '"\n')
542555
b.write('devel\\build_install_pyradio.bat -u\n')
543556
b.write('GOTO endofscript\n')

pyradio/main.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ def shell():
190190
package=package,
191191
python_version_to_use=python_version_to_use
192192
)
193-
upd.update_or_uninstall_on_windows(mode='update-open')
193+
upd.update_or_uninstall_on_windows(
194+
mode='update-open',
195+
from_pyradio=True
196+
)
194197
sys.exit()
195198

196199
if args.uninstall:
@@ -206,7 +209,10 @@ def shell():
206209
package=package,
207210
python_version_to_use=python_version_to_use
208211
)
209-
upd.update_or_uninstall_on_windows(mode='uninstall-open')
212+
upd.update_or_uninstall_on_windows(
213+
mode='uninstall-open',
214+
from_pyradio=True
215+
)
210216
sys.exit()
211217

212218
''' check conflicting parameters '''

0 commit comments

Comments
 (0)