mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:..
This commit is contained in:
parent
1766639e38
commit
2114ea70f2
@ -9,6 +9,8 @@ from setuptools import setup
|
||||
from py2app.build_app import py2app
|
||||
from modulegraph.find_modules import find_modules
|
||||
|
||||
PYTHON = '/Library/Frameworks/Python.framework/Versions/Current/bin/python'
|
||||
|
||||
class BuildAPP(py2app):
|
||||
QT_PREFIX = '/Users/kovid/qt'
|
||||
LOADER_TEMPLATE = \
|
||||
@ -108,15 +110,15 @@ _check_symlinks_prescript()
|
||||
dmg = os.path.join(destdir, volname+'.dmg')
|
||||
if os.path.exists(dmg):
|
||||
os.unlink(dmg)
|
||||
subprocess.check_call(['hdiutil', 'create', '-srcfolder', os.path.abspath(d),
|
||||
subprocess.check_call(['/usr/bin/hdiutil', 'create', '-srcfolder', os.path.abspath(d),
|
||||
'-volname', volname, '-format', format, dmg])
|
||||
if internet_enable:
|
||||
subprocess.check_call(['hdiutil', 'internet-enable', '-yes', dmg])
|
||||
subprocess.check_call(['/usr/bin/hdiutil', 'internet-enable', '-yes', dmg])
|
||||
return dmg
|
||||
|
||||
@classmethod
|
||||
def qt_dependencies(cls, path):
|
||||
pipe = subprocess.Popen('otool -L '+path, shell=True, stdout=subprocess.PIPE).stdout
|
||||
pipe = subprocess.Popen('/usr/bin/otool -L '+path, shell=True, stdout=subprocess.PIPE).stdout
|
||||
deps = []
|
||||
for l in pipe.readlines():
|
||||
match = re.search(r'(.*)\(', l)
|
||||
@ -140,7 +142,7 @@ _check_symlinks_prescript()
|
||||
raise Exception('Unknown Qt dependency')
|
||||
module = match.group(1)
|
||||
newpath = fp + '%s.framework/Versions/Current/%s'%(module, module)
|
||||
cmd = ' '.join(['install_name_tool', '-change', dep, newpath, path])
|
||||
cmd = ' '.join(['/usr/bin/install_name_tool', '-change', dep, newpath, path])
|
||||
subprocess.check_call(cmd, shell=True)
|
||||
|
||||
|
||||
@ -175,11 +177,11 @@ _check_symlinks_prescript()
|
||||
subprocess.check_call(['make'])
|
||||
files.append((os.path.abspath(os.path.realpath('libpictureflow.dylib')), 'libpictureflow.dylib'))
|
||||
os.chdir('PyQt/.build')
|
||||
subprocess.check_call(['python', '../configure.py'])
|
||||
subprocess.check_call(['make'])
|
||||
subprocess.check_call([PYTHON, '../configure.py'])
|
||||
subprocess.check_call(['/usr/bin/make'])
|
||||
files.append((os.path.abspath('pictureflow.so'), 'pictureflow.so'))
|
||||
subprocess.check_call(['install_name_tool', '-change', 'libpictureflow.0.dylib', '@executable_path/../Frameworks/libpictureflow.dylib', 'pictureflow.so'])
|
||||
subprocess.check_call(['install_name_tool', '-change', '/System/Library/Frameworks/Python.framework/Versions/2.5/Python', '@executable_path/../Frameworks/Python.framework/Versions/2.5/Python', 'pictureflow.so'])
|
||||
subprocess.check_call(['/usr/bin/install_name_tool', '-change', 'libpictureflow.0.dylib', '@executable_path/../Frameworks/libpictureflow.dylib', 'pictureflow.so'])
|
||||
subprocess.check_call(['/usr/bin/install_name_tool', '-change', '/System/Library/Frameworks/Python.framework/Versions/2.5/Python', '@executable_path/../Frameworks/Python.framework/Versions/2.5/Python', 'pictureflow.so'])
|
||||
for i in range(2):
|
||||
deps = BuildAPP.qt_dependencies(files[i][0])
|
||||
BuildAPP.fix_qt_dependencies(files[i][0], deps)
|
||||
@ -251,13 +253,13 @@ sys.frameworks_dir = os.path.join(os.path.dirname(os.environ['RESOURCEPATH']), '
|
||||
|
||||
|
||||
def main():
|
||||
auto = '--auto' in sys.argv
|
||||
if auto:
|
||||
sys.argv.remove('--auto')
|
||||
if auto and not os.path.exists('dist/auto'):
|
||||
print '%s does not exist'%os.path.abspath('dist/auto')
|
||||
return 1
|
||||
|
||||
# auto = '--auto' in sys.argv
|
||||
# if auto:
|
||||
# sys.argv.remove('--auto')
|
||||
# if auto and not os.path.exists('dist/auto'):
|
||||
# print '%s does not exist'%os.path.abspath('dist/auto')
|
||||
# return 1
|
||||
#
|
||||
sys.argv[1:2] = ['py2app']
|
||||
setup(
|
||||
name = APPNAME,
|
||||
@ -290,8 +292,10 @@ def main():
|
||||
},
|
||||
setup_requires = ['py2app'],
|
||||
)
|
||||
if auto:
|
||||
subprocess.call(('sudo', 'shutdown', '-h', '+2'))
|
||||
subprocess.check_call('scp dist/*.dmg giskard:work/calibre/dist', shell=True)
|
||||
# if '--shutdown' in sys.argv:
|
||||
# print 'Shutting down'
|
||||
# subprocess.call(('/usr/bin/sudo', '/sbin/shutdown', '-h', '+0'))
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -35,10 +35,8 @@ def sendmail(recipient='', subject='', attachments=[], body=''):
|
||||
pt.write(open(attachments[0], 'rb').read())
|
||||
pt.close()
|
||||
|
||||
try:
|
||||
subprocess.call('open -t '+pt.name, shell=True)
|
||||
except: # For some reason making this call leads to a system call interrupted error
|
||||
pass
|
||||
subprocess.Popen(('open', '-t', pt.name))
|
||||
|
||||
else:
|
||||
body = '"' + body.replace('"', '\\"') + '"'
|
||||
subject = '"' + subject.replace('"', '\\"') + '"'
|
||||
|
13
upload.py
13
upload.py
@ -64,7 +64,18 @@ def build_windows():
|
||||
def build_osx():
|
||||
installer = installer_name('dmg')
|
||||
vm = '/vmware/Mac OSX/Mac OSX.vmx'
|
||||
return build_installer(installer, vm, 20)
|
||||
vmware = ('vmware', '-q', '-x', '-n', vm)
|
||||
subprocess.Popen(vmware)
|
||||
print 'Waiting for OS X to boot up...'
|
||||
time.sleep(120)
|
||||
print 'Trying to ssh into the OS X server'
|
||||
subprocess.check_call(('ssh', 'osx', '/Users/kovid/bin/build-calibre'))
|
||||
if not os.path.exists(installer):
|
||||
raise Exception('Failed to build installer '+installer)
|
||||
subprocess.Popen(('ssh', 'osx', 'sudo', '/sbin/shutdown', '-h', '+1'))
|
||||
return os.path.basename(installer)
|
||||
#return build_installer(installer, vm, 20)
|
||||
|
||||
|
||||
def build_installers():
|
||||
return build_windows(), build_osx()
|
||||
|
Loading…
x
Reference in New Issue
Block a user