mirror of https://github.com/debauchee/barrier.git
Upload 'ns' to plugins dir (create if not exists) #4695
This commit is contained in:
parent
e4959a7661
commit
91d05c29db
|
@ -1343,12 +1343,6 @@ class InternalCommands:
|
|||
|
||||
return major + '.' + minor + '.' + rev
|
||||
|
||||
def ftpUpload(self, ftp, source, target):
|
||||
print "Uploading '%s' as '%s' to FTP server '%s'..." % (
|
||||
source, target, ftp.host)
|
||||
ftp.run(source, target)
|
||||
print 'Done'
|
||||
|
||||
def distftp(self, type, ftp):
|
||||
if not type:
|
||||
raise Exception('Platform type not specified.')
|
||||
|
@ -1359,13 +1353,13 @@ class InternalCommands:
|
|||
|
||||
packageSource = binDir + '/' + self.dist_name(type)
|
||||
packageTarget = self.dist_name_rev(type)
|
||||
self.ftpUpload(ftp, packageSource, packageTarget)
|
||||
ftp.upload(packageSource, packageTarget)
|
||||
|
||||
if (type != 'src'):
|
||||
pluginsDir = binDir + '/plugins'
|
||||
nsPluginSource = self.findLibraryFile(type, pluginsDir, 'ns')
|
||||
nsPluginTarget = self.getLibraryDistFilename(type, pluginsDir, 'ns')
|
||||
self.ftpUpload(ftp, nsPluginSource, nsPluginTarget)
|
||||
ftp.upload(nsPluginSource, nsPluginTarget, "plugins")
|
||||
|
||||
def getLibraryDistFilename(self, type, dir, name):
|
||||
(platform, packageExt, libraryExt) = self.getDistributePlatformInfo(type)
|
||||
|
|
|
@ -23,13 +23,28 @@ class FtpUploader:
|
|||
self.password = password
|
||||
self.dir = dir
|
||||
|
||||
def run(self, src, dest, replace=False):
|
||||
|
||||
def upload(self, src, dest, subDir=None):
|
||||
print "Connecting to '%s'" % self.host
|
||||
ftp = FTP(self.host, self.user, self.password)
|
||||
ftp.cwd(self.dir)
|
||||
|
||||
self.changeDir(ftp, self.dir)
|
||||
|
||||
if subDir:
|
||||
self.changeDir(ftp, subDir)
|
||||
|
||||
print "Uploading '%s' as '%s'" % (src, dest)
|
||||
f = open(src, 'rb')
|
||||
ftp.storbinary('STOR ' + dest, f)
|
||||
f.close()
|
||||
|
||||
ftp.close()
|
||||
|
||||
print "Done"
|
||||
|
||||
def changeDir(self, ftp, dir):
|
||||
if dir not in ftp.nlst():
|
||||
print "Creating dir '%s'" % dir
|
||||
ftp.mkd(dir)
|
||||
|
||||
print "Changing to dir '%s'" % dir
|
||||
ftp.cwd(dir)
|
||||
|
|
Loading…
Reference in New Issue