mirror of
https://github.com/opentx/opentx.git
synced 2025-07-18 22:05:10 +03:00
Compile script bug fix
This commit is contained in:
parent
edc8c4cbb3
commit
35f60e9899
1 changed files with 27 additions and 9 deletions
|
@ -32,16 +32,20 @@ host = "ftpperso.free.fr"
|
|||
user = "open9x"
|
||||
password = None
|
||||
ftp_connection = None
|
||||
ftp_tmpdir = "binaries/temp" + str(int(time.mktime(time.localtime())))
|
||||
ftp_tmpdir = None
|
||||
|
||||
def openFtp():
|
||||
global password
|
||||
global ftp_connection
|
||||
global ftp_tmpdir
|
||||
|
||||
if password is None:
|
||||
password = getpass.getpass()
|
||||
|
||||
ftp_connection = ftplib.FTP(host, user, password)
|
||||
ftp_connection.mkd(ftp_tmpdir)
|
||||
if ftp_tmpdir is None:
|
||||
ftp_tmpdir = "binaries/temp" + str(int(time.mktime(time.localtime())))
|
||||
ftp_connection.mkd(ftp_tmpdir)
|
||||
|
||||
def closeFtp():
|
||||
# ftp_connection.rename("binaries/latest", "binaries/r...")
|
||||
|
@ -49,13 +53,27 @@ def closeFtp():
|
|||
ftp_connection.quit()
|
||||
|
||||
def uploadBinary(binary_name):
|
||||
welcome = ftp_connection.getwelcome()
|
||||
while not welcome:
|
||||
time.sleep(10)
|
||||
openFtp()
|
||||
f = file(BINARY_DIR + binary_name, 'rb')
|
||||
ftp_connection.storbinary('STOR ' + ftp_tmpdir + '/' + binary_name, f)
|
||||
f.close()
|
||||
while 1:
|
||||
try:
|
||||
try:
|
||||
ftp_connection.delete(ftp_tmpdir + '/' + binary_name)
|
||||
except:
|
||||
pass
|
||||
f = file(BINARY_DIR + binary_name, 'rb')
|
||||
ftp_connection.storbinary('STOR ' + ftp_tmpdir + '/' + binary_name, f)
|
||||
f.close()
|
||||
return
|
||||
except:
|
||||
time.sleep(10)
|
||||
try:
|
||||
ftp_connection.quit()
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
openFtp()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def generate(hex, arg, extension, options, maxsize):
|
||||
result = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue