Skip to content

Commit 0478279

Browse files
committed
Fixing referenced before assignment
This is the error message which appears without the change: ''' [INFO]: # Downloading recipes [INFO]: Downloading qt5 [DEBUG]: -> running mkdir -p /home/thopiekar/.local/share/python-for-android/packages/qt5 [INFO]: -> directory context /home/thopiekar/.local/share/python-for-android/packages/qt5 [DEBUG]: -> running basename http://download.qt.io/official_releases/qt/5.7/5.7.0/single/qt-everywhere-opensource-src-5.7.0.tar.gz [DEBUG]: qt-everywhere-opensource-src-5.7.0.tar.gz [WARNING]: Should check headers here! Skipping for now. Downloading qt5 from http://download.qt.io/official_releases/qt/5.7/5.7.0/single/qt-everywhere-opensource-src-5.7.0.tar.gz [DEBUG]: -> running rm -f .mark-qt-everywhere-opensource-src-5.7.0.tar.gz [INFO]: Downloading qt5 from http://download.qt.io/official_releases/qt/5.7/5.7.0/single/qt-everywhere-opensource-src-5.7.0.tar.gz [DEBUG]: -> running touch .mark-qt-everywhere-opensource-src-5.7.0.tar.gz Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/media/hdd/home/thopiekar/Projekte/GIT/thopiekar/python-for-android_fork/pythonforandroid/toolchain.py", line 837, in <module> main() File "/media/hdd/home/thopiekar/Projekte/GIT/thopiekar/python-for-android_fork/pythonforandroid/toolchain.py", line 834, in main ToolchainCL() File "/media/hdd/home/thopiekar/Projekte/GIT/thopiekar/python-for-android_fork/pythonforandroid/toolchain.py", line 489, in __init__ getattr(self, args.subparser_name.replace('-', '_'))(args) File "/media/hdd/home/thopiekar/Projekte/GIT/thopiekar/python-for-android_fork/pythonforandroid/toolchain.py", line 147, in wrapper_func build_dist_from_args(ctx, dist, args) File "/media/hdd/home/thopiekar/Projekte/GIT/thopiekar/python-for-android_fork/pythonforandroid/toolchain.py", line 190, in build_dist_from_args build_recipes(build_order, python_modules, ctx) File "pythonforandroid/build.py", line 540, in build_recipes File "pythonforandroid/recipe.py", line 342, in download_if_necessary File "pythonforandroid/recipe.py", line 385, in download UnboundLocalError: local variable 'current_md5' referenced before assignment '''
1 parent 5ce57ca commit 0478279

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pythonforandroid/recipe.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,12 @@ def download(self):
381381
self.download_file(url, filename)
382382
shprint(sh.touch, marker_filename)
383383

384-
if self.md5sum is not None:
385-
print('downloaded md5: {}'.format(current_md5))
386-
print('expected md5: {}'.format(self.md5sum))
387-
print('md5 not handled yet, exiting')
388-
exit(1)
384+
if exists(filename) and isfile(filename) and self.md5sum:
385+
if self.md5sum is not None:
386+
print('downloaded md5: {}'.format(current_md5))
387+
print('expected md5: {}'.format(self.md5sum))
388+
print('md5 not handled yet, exiting')
389+
exit(1)
389390

390391
def unpack(self, arch):
391392
info_main('Unpacking {} for {}'.format(self.name, arch))

0 commit comments

Comments
 (0)