mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 14:25:11 +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,15 +32,19 @@ host = "ftpperso.free.fr"
|
||||||
user = "open9x"
|
user = "open9x"
|
||||||
password = None
|
password = None
|
||||||
ftp_connection = None
|
ftp_connection = None
|
||||||
ftp_tmpdir = "binaries/temp" + str(int(time.mktime(time.localtime())))
|
ftp_tmpdir = None
|
||||||
|
|
||||||
def openFtp():
|
def openFtp():
|
||||||
global password
|
global password
|
||||||
global ftp_connection
|
global ftp_connection
|
||||||
|
global ftp_tmpdir
|
||||||
|
|
||||||
if password is None:
|
if password is None:
|
||||||
password = getpass.getpass()
|
password = getpass.getpass()
|
||||||
|
|
||||||
ftp_connection = ftplib.FTP(host, user, password)
|
ftp_connection = ftplib.FTP(host, user, password)
|
||||||
|
if ftp_tmpdir is None:
|
||||||
|
ftp_tmpdir = "binaries/temp" + str(int(time.mktime(time.localtime())))
|
||||||
ftp_connection.mkd(ftp_tmpdir)
|
ftp_connection.mkd(ftp_tmpdir)
|
||||||
|
|
||||||
def closeFtp():
|
def closeFtp():
|
||||||
|
@ -49,13 +53,27 @@ def closeFtp():
|
||||||
ftp_connection.quit()
|
ftp_connection.quit()
|
||||||
|
|
||||||
def uploadBinary(binary_name):
|
def uploadBinary(binary_name):
|
||||||
welcome = ftp_connection.getwelcome()
|
while 1:
|
||||||
while not welcome:
|
try:
|
||||||
time.sleep(10)
|
try:
|
||||||
openFtp()
|
ftp_connection.delete(ftp_tmpdir + '/' + binary_name)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
f = file(BINARY_DIR + binary_name, 'rb')
|
f = file(BINARY_DIR + binary_name, 'rb')
|
||||||
ftp_connection.storbinary('STOR ' + ftp_tmpdir + '/' + binary_name, f)
|
ftp_connection.storbinary('STOR ' + ftp_tmpdir + '/' + binary_name, f)
|
||||||
f.close()
|
f.close()
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
time.sleep(10)
|
||||||
|
try:
|
||||||
|
ftp_connection.quit()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
openFtp()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def generate(hex, arg, extension, options, maxsize):
|
def generate(hex, arg, extension, options, maxsize):
|
||||||
result = []
|
result = []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue