Port get_nsis to Python using the new API
This commit is contained in:
parent
dfdffbe5cc
commit
de1b6762da
@ -30,6 +30,7 @@ import shutil
|
||||
import glob
|
||||
import re
|
||||
import tarfile
|
||||
import zipfile
|
||||
from email.utils import formatdate
|
||||
from datetime import tzinfo
|
||||
import time
|
||||
@ -179,7 +180,7 @@ def box_draw(msg):
|
||||
| %s%s|
|
||||
+-----------------------------------------------------------------------------+'''%(msg, spacer)
|
||||
|
||||
def wget(url):
|
||||
def wget(url, out_dir):
|
||||
file_name = url.split('/')[-1]
|
||||
print "HTTP request sent, awaiting response... "
|
||||
u = urllib2.urlopen(url)
|
||||
@ -187,7 +188,7 @@ def wget(url):
|
||||
print "Connected to %s [200 OK]"%(url)
|
||||
else:
|
||||
exit()
|
||||
f = open(file_name, 'wb')
|
||||
f = open(os.path.join(out_dir, file_name), 'wb')
|
||||
meta = u.info()
|
||||
file_size = int(meta.getheaders("Content-Length")[0])
|
||||
print "Downloading: %s Bytes: %s" % (file_name, file_size)
|
||||
@ -663,6 +664,38 @@ cling (%s-1) unstable; urgency=low
|
||||
box_draw("Run debuild to create Debian package")
|
||||
exec_subprocess_call('debuild', prefix)
|
||||
|
||||
###############################################################################
|
||||
# Windows specific functions (ported from windows_dep.sh) #
|
||||
###############################################################################
|
||||
|
||||
def get_win_dep():
|
||||
box_draw("Download NSIS compiler")
|
||||
html = urllib2.urlopen('http://sourceforge.net/p/nsis/code/HEAD/tree/NSIS/tags/').read()
|
||||
NSIS_VERSION = html[html.rfind('<a href="v'):html.find('>', html.rfind('<a href="v'))].strip('<a href="v').strip('"')
|
||||
NSIS_VERSION = NSIS_VERSION[:1] + '.' + NSIS_VERSION[1:]
|
||||
print 'Latest version of NSIS is: ' + NSIS_VERSION
|
||||
wget(url="http://sourceforge.net/projects/nsis/files/NSIS%%203%%20Pre-release/%s/nsis-%s.zip"%(NSIS_VERSION, NSIS_VERSION),
|
||||
out_dir=TMP_PREFIX)
|
||||
print 'Extracting: ' + os.path.join(TMP_PREFIX, 'nsis-%s.zip'%(NSIS_VERSION))
|
||||
zip = zipfile.ZipFile(os.path.join(TMP_PREFIX, 'nsis-%s.zip'%(NSIS_VERSION)))
|
||||
zip.extractall(os.path.join(TMP_PREFIX, 'bin'))
|
||||
print 'Remove file: ' + os.path.join(TMP_PREFIX, 'nsis-%s.zip'%(NSIS_VERSION))
|
||||
os.remove(os.path.join(TMP_PREFIX, 'nsis-%s.zip'%(NSIS_VERSION)))
|
||||
os.rename(os.path.join(TMP_PREFIX, 'bin', 'nsis-%s'%(NSIS_VERSION)), os.path.join(TMP_PREFIX, 'bin', 'nsis'))
|
||||
|
||||
box_draw("Download CMake for Windows")
|
||||
html = urllib2.urlopen('http://www.cmake.org/cmake/resources/software.html').read()
|
||||
CMAKE_VERSION = html[html.find('Latest Release ('): html.find(')', html.find('Latest Release ('))].strip('Latest Release (')
|
||||
print 'Latest stable version of CMake is: ' + CMAKE_VERSION
|
||||
wget(url='http://www.cmake.org/files/v%s/cmake-%s-win32-x86.zip'%(CMAKE_VERSION[:3], CMAKE_VERSION),
|
||||
out_dir=TMP_PREFIX)
|
||||
print 'Extracting: ' + os.path.join(TMP_PREFIX, 'cmake-%s-win32-x86.zip'%(CMAKE_VERSION))
|
||||
zip = zipfile.ZipFile(os.path.join(TMP_PREFIX, 'cmake-%s-win32-x86.zip'%(CMAKE_VERSION)))
|
||||
zip.extractall(os.path.join(TMP_PREFIX, 'bin'))
|
||||
print 'Remove file: ' + os.path.join(TMP_PREFIX, 'cmake-%s-win32-x86.zip'%(CMAKE_VERSION))
|
||||
os.remove(os.path.join(TMP_PREFIX, 'cmake-%s-win32-x86.zip'%(CMAKE_VERSION)))
|
||||
os.rename(os.path.join(TMP_PREFIX, 'bin', 'cmake-%s-win32-x86'%(CMAKE_VERSION)), os.path.join(TMP_PREFIX, 'bin', 'cmake'))
|
||||
|
||||
|
||||
###############################################################################
|
||||
# argparse configuration #
|
||||
|
Loading…
x
Reference in New Issue
Block a user