def upload(): print 'Connecting to Server...' print UPDATE_SERVER_USER + ' ' + UPDATE_SERVER_PWD + ' ' + UPDATE_SERVER_PATH ftp = FTP(UPDATE_SERVER_URL) ftp.login(UPDATE_SERVER_USER, UPDATE_SERVER_PWD) ftp.cwd(UPDATE_SERVER_PATH) print 'Uploading full game...' fullGamePath = os.path.join(OUT_DIR, 'latest.7z') progress = Progress(os.stat(fullGamePath).st_size, 50) progress.print_header(10) with open(fullGamePath, 'rb') as f: ftp.storbinary('STOR latest', f, blocksize=8192, callback=lambda x: progress.add_progress(8192)) print 'Uploading patch...' version = find_application_version(NEW_DIR) patchPath = os.path.join(OUT_DIR, 'patches', 'v' + str(version)) progress = Progress(os.stat(patchPath).st_size, 50) progress.print_header(10) with open(patchPath, 'rb') as f: ftp.cwd('patches') ftp.storbinary('STOR v' + str(version), f, blocksize=8192, callback=lambda x: progress.add_progress(8192)) ftp.quit() print 'Upload Complete'
def upload(): print 'Connecting to Server...' print UPDATE_SERVER_USER + ' ' + UPDATE_SERVER_PWD + ' ' + UPDATE_SERVER_PATH ftp = FTP(UPDATE_SERVER_URL) ftp.login(UPDATE_SERVER_USER, UPDATE_SERVER_PWD) ftp.cwd(UPDATE_SERVER_PATH) print 'Uploading full game...' fullGamePath = os.path.join(OUT_DIR, 'latest.7z') progress = Progress(os.stat(fullGamePath).st_size, 50) progress.print_header(10) with open(fullGamePath, 'rb') as f: ftp.storbinary('STOR latest', f, blocksize=8192, callback = lambda x: progress.add_progress(8192)) print 'Uploading patch...' version = find_application_version(NEW_DIR) patchPath = os.path.join(OUT_DIR, 'patches', 'v' + str(version)) progress = Progress(os.stat(patchPath).st_size, 50) progress.print_header(10) with open(patchPath, 'rb') as f: ftp.cwd('patches') ftp.storbinary('STOR v' + str(version), f, blocksize=8192, callback = lambda x: progress.add_progress(8192)) ftp.quit() print 'Upload Complete'
def create_patch(): print 'creating patch' tmpFile = bindirpatch.create_patch(OLD_DIR, NEW_DIR, TEMP_DIR) newVersion = find_application_version(NEW_DIR) outFile = os.path.join(OUT_DIR, 'patches', 'v' + str(newVersion)) os.rename(tmpFile, outFile)
def increment_version(): print 'incrementing version' oldVersion = find_application_version(OLD_DIR) versionFileName = os.path.join(NEW_DIR, 'VERSION') with open(versionFileName, 'w') as versionFile: versionFile.write(str(oldVersion + 1))
def find_current_version(): return find_application_version(PROJECT_DIR)
def increment_version(): print 'incrementing version' oldVersion = find_application_version(OLD_DIR) versionFileName = os.path.join(NEW_DIR, 'VERSION') with open(versionFileName, 'w') as versionFile: versionFile.write(str(oldVersion+1))