From 9fb1e108e4c85d517d34e28f646b64ac6123e84c Mon Sep 17 00:00:00 2001 From: AndreyTapekhin Date: Mon, 17 Apr 2017 20:12:44 +0300 Subject: [PATCH] updater changed urls --- pre_update.pyw | 27 ++++++++++++--------------- update1.pyw | 44 +++++++++++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/pre_update.pyw b/pre_update.pyw index f0b63edc5..1800c3deb 100644 --- a/pre_update.pyw +++ b/pre_update.pyw @@ -161,7 +161,7 @@ class Example(QWidget): quitbt = QPushButton('Cancel', self) quitbt.clicked.connect(self.quit) quitbt.resize(quitbt.sizeHint()) - quitbt.move(100, 70) + quitbt.move(150, 70) quitbt.setDisabled(True) self.quitbt = quitbt @@ -297,26 +297,23 @@ class Example(QWidget): for asset in assets: if asset['name'] == 'update.zip': - new_update1 = asset['browser_download_url'] - # if asset['name'] == 'update2.pyw': - # new_update2 = asset['browser_download_url'] - - # if not new_update: - # self.message( - # "No updater found", - # "Release contains no updater" - # ) - # return - - new_update = 'https://www.dropbox.com/s/6stohg7cxcawi9c/update.zip?dl=1' + new_update = asset['browser_download_url'] + + if not new_update: + self.message( + "No updater found", + "Release contains no updater" + ) + return + + # new_update = 'https://www.dropbox.com/s/6stohg7cxcawi9c/update.zip?dl=1' if os.path.exists('update1.pyw'): os.remove('update1.pyw') if os.path.exists('update2.pyw'): os.remove('update2.pyw') if self.workerLoop(new_update, 'https://'): return - # if self.workerLoop(new_update2, 'https://'): - # return + self.changetext("Updating in progress. New updater downloaded. Running updater") pythonw = cur_path + "\\env86\\python-3.4.4\\pythonw.exe" diff --git a/update1.pyw b/update1.pyw index b466bf9c6..869c1719e 100644 --- a/update1.pyw +++ b/update1.pyw @@ -100,7 +100,7 @@ class Worker(QObject): status_code = 200 dump = file.raw - self.sig_progress.emit(30) + # self.sig_progress.emit(30) if os.path.exists(file_type_path): os.remove(file_type_path) with open(file_type_path, 'wb') as file_type: @@ -128,7 +128,7 @@ class Worker(QObject): if os.path.exists(new_file_type): shutil.rmtree(new_file_type) folder = cur_path + "\\" + folder.split('/')[0] - self.sig_progress.emit(50) + # self.sig_progress.emit(50) new_file_type = cur_path + "\\new_%s" % self.file_type # remove(new_file_type) @@ -145,7 +145,7 @@ class Worker(QObject): if path != file_type_hash_path: os.remove(path) # self.sig_msg.emit("Updating in progress. Sources Downloaded. Upgrading pip.") - self.sig_progress.emit(55) + # self.sig_progress.emit(55) except OSError as e: status_code = -1 @@ -358,34 +358,42 @@ class Example(QWidget): tag_file.write(str(new_tag)) self.progress.setValue(10) self.loop.processEvents(QEventLoop.ExcludeUserInputEvents) + connection_string = server['zipball_url'] + assets = server['assets'] + ffmpeg = None + memcached = None + for asset in assets: + if asset['name'] == 'ffmpeg.zip': + ffmpeg = asset['browser_download_url'] + if asset['name'] == 'memcached.zip': + memcached = asset['browser_download_url'] # connection_string = "https://codeload.github.com/ispras/lingvodoc/zip/heavy_refactor" # todo: remove - connection_string = "https://codeload.github.com/LukeTapekhin/lingvodoc/zip/heavy_refactor" # todo: remove + # connection_string = "https://codeload.github.com/LukeTapekhin/lingvodoc/zip/heavy_refactor" # todo: remove if self.workerLoop(connection_string, new_tag, 'source', 'https://'): return self.changetext("Updating in progress. Sources downloaded. Downloading memcached") + self.progress.setValue(30) - connection_string = "https://www.dropbox.com/s/j73nstxm8xze17z/memchached.zip?dl=1" # todo: remove - - if self.workerLoop(connection_string, '123432', 'memcached', 'https://'): - return - self.changetext("Updating in progress. Memcached dDownloaded. Downloading ffmpeg") - - connection_string = "https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-3.2.4-win32-static.zip" + # memcached = "https://www.dropbox.com/s/j73nstxm8xze17z/memchached.zip?dl=1" # todo: remove + if memcached: + if self.workerLoop(memcached, '123432', 'memcached', 'https://'): + return + self.changetext("Updating in progress. Memcached downloaded. Downloading ffmpeg") + self.progress.setValue(35) - if self.workerLoop(connection_string, '3.2.4', 'ffmpeg', 'https://'): - return + # ffmpeg = "https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-3.2.4-win32-static.zip" + if ffmpeg: + if self.workerLoop(ffmpeg, '3.2.4', 'ffmpeg', 'https://'): + return self.changetext("Updating in progress. Ffmpeg downloaded. Upgrading pip.") + self.progress.setValue(50) new_source = cur_path + "\\new_source" - - # python = cur_path + "\\env86\\python-3.4.4\\python.exe" pythonw = cur_path + "\\env86\\python-3.4.4\\pythonw.exe" - # pip = cur_path + "\\env86\\python-3.4.4\\Scripts\\pip.exe" setup = new_source + "\\desktop-setup.py" requirements = new_source + "\\desktop-requirements.txt" - new_update = new_source + "\\update.pyw" proc = Popen([pythonw, '-m', 'pip', 'install', '--upgrade', 'pip'], stdout=PIPE, stderr=PIPE) streamdata = proc.communicate()[1] @@ -400,6 +408,7 @@ class Example(QWidget): self.changetext("Updating in progress. Pip upgraded. Updating packages") self.progress.setValue(55) self.loop.processEvents(QEventLoop.ExcludeUserInputEvents) + proc = Popen([pythonw, '-m', 'pip', 'install', '-r', os.path.normpath(requirements)], stdout=PIPE, stderr=PIPE) streamdata = proc.communicate()[1] @@ -414,6 +423,7 @@ class Example(QWidget): self.changetext("Updating in progress. Packages updated. Setuping") self.progress.setValue(60) self.loop.processEvents(QEventLoop.ExcludeUserInputEvents) + proc = Popen([pythonw, setup, 'install'], stdout=PIPE, stderr=PIPE, cwd='%s\\new_source' % cur_path) streamdata = proc.communicate()[1] rc = proc.returncode