mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Abortive attempt at building an msi installer.
This commit is contained in:
parent
47010fb85d
commit
aa06fcfb1a
@ -25,6 +25,11 @@ from py2exe.build_exe import py2exe as build_exe
|
|||||||
from libprs500 import __version__ as VERSION
|
from libprs500 import __version__ as VERSION
|
||||||
from libprs500 import __appname__ as APPNAME
|
from libprs500 import __appname__ as APPNAME
|
||||||
|
|
||||||
|
PY2EXE_DIR = os.path.join('build','py2exe')
|
||||||
|
if os.path.exists(PY2EXE_DIR):
|
||||||
|
shutil.rmtree(PY2EXE_DIR)
|
||||||
|
|
||||||
|
|
||||||
class NSISInstaller(object):
|
class NSISInstaller(object):
|
||||||
TEMPLATE = r'''
|
TEMPLATE = r'''
|
||||||
SetCompressor lzma
|
SetCompressor lzma
|
||||||
@ -229,6 +234,95 @@ SectionEnd
|
|||||||
else:
|
else:
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
|
||||||
|
class WixInstaller(object):
|
||||||
|
'''
|
||||||
|
Make a .msi installer. Can't get the driver installation to play well with
|
||||||
|
an existing installation of the connect USB driver.
|
||||||
|
'''
|
||||||
|
TEMPLATE=\
|
||||||
|
r'''<?xml version='1.0' encoding='windows-1252'?>
|
||||||
|
<Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>
|
||||||
|
|
||||||
|
<Product Name='%(appname)s' Id='955DF7A2-8861-46A9-8710-56A4BDEA8E29'
|
||||||
|
Language='1033' Codepage='1252' Version='%(version)s' Manufacturer='Kovid Goyal'>
|
||||||
|
|
||||||
|
<Package Id='????????-????-????-????-????????????' Keywords='Installer'
|
||||||
|
Description="Ebook management software"
|
||||||
|
Manufacturer='Kovid Goyal'
|
||||||
|
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
|
||||||
|
<Icon Id="appicon.ico" SourceFile="icons\library.ico" />
|
||||||
|
<Binary Id="devcon" SourceFile="C:\devcon\i386\devcon.exe" />
|
||||||
|
<Condition Message="You need to be an administrator to install this product.">
|
||||||
|
Privileged
|
||||||
|
</Condition>
|
||||||
|
<Property Id='ARPNOMODIFY'>1</Property>
|
||||||
|
<Property Id='ARPURLINFOABOUT'>http://libprs500.kovidgoyal.net</Property>
|
||||||
|
<Property Id='ARPPRODUCTICON'>appicon.ico</Property>
|
||||||
|
<Media Id='1' Cabinet='%(appname)s.cab' EmbedCab='yes' />
|
||||||
|
<Directory Id='TARGETDIR' Name='SourceDir'>
|
||||||
|
<Directory Id='ProgramFilesFolder' Name='PFiles'>
|
||||||
|
<Directory Id='INSTALLDIR' Name='libprs' LongName='%(appname)s'>
|
||||||
|
%(py2exefiles)s
|
||||||
|
<Directory Id='driver' Name='driver' FileSource="C:\libusb-prs500">
|
||||||
|
<Component Id="usbdriver" DriverSequence="0" Guid="1169D502-DE59-4153-BC0D-712894C37FEF">
|
||||||
|
<File Id='libusb0.dll' Name='libusb0.dll' Vital='yes' Compressed='yes' DiskId="1" />
|
||||||
|
<File Id='libusb0.sys' Name='libusb0.sys' Vital='yes' Compressed='yes' DiskId="1" />
|
||||||
|
<File Id='libusb0_x64.dll' Name='a' LongName='libusb0_x64.dll' Vital='yes' Compressed='yes' DiskId="1" />
|
||||||
|
<File Id='libusb0_x64.sys' Name='b' LongName='libusb0_x64.sys' Vital='yes' Compressed='yes' DiskId="1" />
|
||||||
|
<File Id='prs500.inf' Name='prs500.inf' Vital='yes' Compressed='yes' DiskId="1" />
|
||||||
|
</Component>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
<Component Id='misc' Guid=''>
|
||||||
|
<Environment Id='UpdatePath' Name='PATH' Action='create' System='yes'
|
||||||
|
Part='last' Value='[INSTALLDIR]' Permanent="no"/>
|
||||||
|
</Component>
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Feature Id='Complete' Title="%(appname)s" Description="The complete package">
|
||||||
|
<ComponentRef Id='py2exe' />
|
||||||
|
<ComponentRef Id='usbdriver' />
|
||||||
|
<ComponentRef Id='misc' />
|
||||||
|
</Feature>
|
||||||
|
</Product>
|
||||||
|
|
||||||
|
</Wix>
|
||||||
|
'''
|
||||||
|
CANDLE=r'C:\wix\candle.exe '
|
||||||
|
LIGHT=r'C:\wix\light.exe -out %s -loc C:\wix\WixUI_en-us.wxl %s c:\wix\wixui.wixlib "C:\Program Files\Driver Installation Tools 2.01\DIFxApp\English-US\WiXLib\x86\DIFxApp.wixlib"'
|
||||||
|
|
||||||
|
def __init__(self, py2exe_dir, dest_dir='dist'):
|
||||||
|
self.py2exe_dir = py2exe_dir
|
||||||
|
self.dest_dir = dest_dir
|
||||||
|
filelist = []
|
||||||
|
print self.py2exe_dir
|
||||||
|
for root, dirs, files in os.walk(self.py2exe_dir):
|
||||||
|
for name in files:
|
||||||
|
path = os.path.abspath(os.path.join(root, name))
|
||||||
|
filelist.append(path)
|
||||||
|
component = "<Component Id='py2exe' DiskId='1' Guid='0248CACF-FDF5-4E68-B898-227C16F1C7B8'>\n"
|
||||||
|
counter = 0
|
||||||
|
for path in filelist:
|
||||||
|
entry = '<File Id="file%d" Name="fn%d" Compressed="yes" Vital="yes" Source="%s" LongName="%s" />'%\
|
||||||
|
(counter, counter, path, os.path.basename(path))
|
||||||
|
component += entry + "\n"
|
||||||
|
counter += 1
|
||||||
|
component += '</Component>'
|
||||||
|
self.installer = self.TEMPLATE%dict(appname=APPNAME, version=VERSION,
|
||||||
|
py2exefiles=component)
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
f = open('installer.wxs', 'w')
|
||||||
|
f.write(self.installer)
|
||||||
|
f.close()
|
||||||
|
subprocess.check_call(self.CANDLE + ' ' + f.name, shell=True)
|
||||||
|
subprocess.check_call(self.LIGHT%(os.path.join(self.dest_dir, APPNAME + '-' + VERSION + '.msi'),
|
||||||
|
' installer.wixobj'), shell=True)
|
||||||
|
|
||||||
|
os.remove('installer.wxs')
|
||||||
|
os.remove('installer.wixobj')
|
||||||
|
|
||||||
|
|
||||||
class BuildEXE(build_exe):
|
class BuildEXE(build_exe):
|
||||||
manifest_resource_id = 0
|
manifest_resource_id = 0
|
||||||
@ -284,9 +378,6 @@ class BuildEXE(build_exe):
|
|||||||
console = [dict(dest_base=basenames['console'][i], script=scripts['console'][i])
|
console = [dict(dest_base=basenames['console'][i], script=scripts['console'][i])
|
||||||
for i in range(len(scripts['console']))]
|
for i in range(len(scripts['console']))]
|
||||||
|
|
||||||
PY2EXE_DIR = os.path.join('build','py2exe')
|
|
||||||
if os.path.exists(PY2EXE_DIR):
|
|
||||||
shutil.rmtree(PY2EXE_DIR)
|
|
||||||
setup(
|
setup(
|
||||||
cmdclass = {'py2exe': BuildEXE},
|
cmdclass = {'py2exe': BuildEXE},
|
||||||
windows = [{'script' : scripts['gui'][0],
|
windows = [{'script' : scripts['gui'][0],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user