From: robk-tahoe Date: Tue, 15 Jan 2008 00:53:54 +0000 (-0700) Subject: windows installer build refinements X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/something?a=commitdiff_plain;h=3cb08209d2f937186b9997e0320e7ae1a9c28fa5;p=tahoe-lafs%2Ftahoe-lafs.git windows installer build refinements this resolves problems of py2exe's modulefinder collection of sources from .zipped egg files, not by using easy_install to reach the --always-unzip option, but rather with a small tool which unpacks any zipped egg files found in misc/dependencies. this fixes the py2exe build given rollback of the easy_install stuff which had broken the unix builds. misc/hatch-eggs.py performs the honours. this also includes a misc/sub-ver.py tool which substitutes elements of the verion number for the current code base (by importing allmydata.__version__ hence make-version should be run first, and the python path carefully managed) into template files using python's string interpolation of named args from a dict as the templating syntax. i.e. %(major)d %(minor)d %(point)d %(nano)d each expand to the individual components of the version number as codified by the pyutil.version_class.Version class. there is also a %(build)s tag which expands to the string form of the whole version number. This tool is used to interpolate the automatically generated version information into the innosetup source file in a form consistent with innosetup/windows' restrictions --- diff --git a/Makefile b/Makefile index ee84b9d5..04cd201a 100644 --- a/Makefile +++ b/Makefile @@ -417,9 +417,18 @@ deb-gutsy-head: fakeroot debian/rules binary # These targets provide for windows native builds +INNOSETUP := $(shell cygpath -au "$(PROGRAMFILES)/Inno Setup 5/Compil32.exe") -windows-exe: - PYTHON=$(PYTHON) $(PP) $(MAKE) -C windows +.PHONY: hatch-eggs windows-exe windows-installer + +hatch-eggs: + $(PP) $(PYTHON) misc/hatch-eggs.py + +windows-exe: hatch-eggs + #PYTHON=$(PYTHON) $(PP) $(MAKE) -C windows + cd windows && $(PP) $(PYTHON) setup.py py2exe windows-installer: windows-exe - $(MAKE) -C windows installer + $(PP) $(PYTHON) misc/sub-ver.py windows/installer.tmpl >windows/installer.iss + cd windows && "$(INNOSETUP)" /cc installer.iss + diff --git a/misc/hatch-eggs.py b/misc/hatch-eggs.py new file mode 100644 index 00000000..6793328d --- /dev/null +++ b/misc/hatch-eggs.py @@ -0,0 +1,41 @@ +#! /usr/bin/python + +import os.path +import sys +import zipfile + +path = [] +if sys.platform == 'win32': + support_lib = "support/Lib/site-packages" +else: + pyver = "python%d.%d" % (sys.version_info[:2]) + support_lib = "support/lib/%s/site-packages" % pyver + +if os.path.exists(support_lib): + for fn in os.listdir(support_lib): + if fn.endswith(".egg"): + path.append(os.path.abspath(os.path.join(support_lib, fn))) + +# We also need to include .egg's in the CWD, because if there is an .egg there +# then "make build-deps" will take that as satisfying its requirements. +for fn in os.listdir("."): + if fn.endswith(".egg"): + path.append(os.path.abspath(os.path.join(os.getcwd(), fn))) + +for eggpath in path: + if os.path.isfile(eggpath): + bak = eggpath + '.bak' + os.rename(eggpath, bak) + os.mkdir(eggpath) + zf = zipfile.ZipFile(bak, 'r') + print bak + for name in zf.namelist(): + dirname = os.path.join(eggpath, os.path.dirname(name)) + if not os.path.isdir(dirname): + print 'creating', dirname + os.makedirs(dirname) + print name + f = file(os.path.join(eggpath, name), 'wb') + f.write(zf.read(name)) + f.close() + diff --git a/misc/sub-ver.py b/misc/sub-ver.py new file mode 100644 index 00000000..c5e0e83f --- /dev/null +++ b/misc/sub-ver.py @@ -0,0 +1,26 @@ +#! /usr/bin/python + +from allmydata import __version__ as v + +import sys + +if len(sys.argv) == 1: + input = sys.stdin +elif len(sys.argv) == 2: + fname = sys.argv[1] + input = file(fname, 'rb') +else: + raise ValueError('must provide 0 or 1 argument (stdin, or filename)') + +vern = { + 'major': v.major, + 'minor': v.minor, + 'point': v.micro, + 'micro': v.micro, + 'nano' : v.nano, + 'build': str(v), + } + +for line in input.readlines(): + print line % vern, + diff --git a/windows/Makefile b/windows/Makefile deleted file mode 100644 index fc06a02c..00000000 --- a/windows/Makefile +++ /dev/null @@ -1,12 +0,0 @@ - -INNOSETUP := $(shell cygpath -u "$(PROGRAMFILES)/Inno Setup 5/Compile32.exe") - -# note that this requires the python path to be set appropriately, and hence this -# should be invoked by calling the windows-exe taget in the top level makefile - -windows-exe: - $(PYTHON) setup.py py2exe - -installer: - $(INNOSETUP) - #$(INNOSETUP) /cc installer.iss diff --git a/windows/installer.iss b/windows/installer.iss deleted file mode 100644 index 3e6bfe80..00000000 --- a/windows/installer.iss +++ /dev/null @@ -1,51 +0,0 @@ -[Setup] -AppName=Allmydata Tahoe -AppVerName=Allmydata Tahoe 2.9 -AppVersion=2.9.0 -VersionInfoVersion=2.9.0 -AppPublisher=Allmydata Inc. -AppPublisherURL=http://www.allmydata.com/ -AppSupportURL=http://www.allmydata.com/support/ -DefaultDirName={pf}\Allmydata.Tahoe -DefaultGroupName=Allmydata -; minumum version NT 4, no classic windows -MinVersion=0,4.0 -Compression=lzma/max -SolidCompression=yes -OutputDir=installer/Allmydata_Tahoe_Setup_v2_9_0.exe -SourceDir=dist -SetupIconFile=installer.ico -UninstallDisplayIcon=installer.ico -; license file needs to be build/all dir -;LicenseFile=../license.txt -OutputBaseFilename=AllmydataSetup-%BUILD% - -[Files] -; contents of 'binaries' dir. (consolidated build target) -Source: "*.*"; DestDir: "{app}\Install"; Flags: restartreplace replacesameversion uninsrestartdelete -Source: ".\web\*.*"; DestDir: "{app}\web"; Flags: recursesubdirs - -[Dirs] -Name: "{app}\noderoot" - -[Icons] -; Program files entries -Name: "{group}\Tahoe root dir (web)"; Filename: "{app}\Install\tahoe.exe"; Parameters: "webopen" -Name: "{group}\Allmydata Help"; Filename: "http://www.allmydata.com/help.php" - -[Run] -; Things performed before the final page of the installer -Filename: "{app}\Install\tahoesvc.exe"; Parameters: "-install"; Flags: runhidden -Filename: "{app}\Install\tahoe.exe"; Parameters: "create-client ""{app}\noderoot"""; Description: "Set the node into debug logging mode"; Flags: runhidden -Filename: "{app}\Install\confwiz.exe"; Flags: hidewizard -;Filename: "{app}\Install\ReadMe.txt"; Description: "View the ReadMe file"; Flags: unchecked postinstall nowait shellexec skipifdoesntexist - -[UninstallRun] -; Performed before the uninstaller runs to undo things -Filename: "{sys}\net.exe"; Parameters: "stop Tahoe"; Flags: runhidden -Filename: "{app}\Install\tahoesvc.exe"; Parameters: "-remove"; Flags: runhidden -;Filename: "http://www.allmydata.com/redirect/uninstallsurvey.php?build=%BUILD%"; Flags: shellexec - -[Registry] -Root: HKLM; Subkey: "Software\Allmydata"; Flags: uninsdeletekeyifempty -Root: HKLM; Subkey: "Software\Allmydata"; ValueType: string; ValueName: "Base Dir Path"; ValueData: "{app}\noderoot"; Flags: uninsdeletekey diff --git a/windows/installer.tmpl b/windows/installer.tmpl new file mode 100644 index 00000000..2d07f8b9 --- /dev/null +++ b/windows/installer.tmpl @@ -0,0 +1,51 @@ +[Setup] +AppName=Allmydata Tahoe +AppVerName=Allmydata Tahoe %(major)d.%(minor)d +AppVersion=%(major)d.%(minor)d.%(point)d-%(nano)d +VersionInfoVersion=%(major)d.%(minor)d.%(point)d.%(nano)d +AppPublisher=Allmydata Inc. +AppPublisherURL=http://www.allmydata.com/ +AppSupportURL=http://www.allmydata.com/support/ +DefaultDirName={pf}\Allmydata.Tahoe +DefaultGroupName=Allmydata +; minumum version NT 4, no classic windows +MinVersion=0,4.0 +Compression=lzma/max +SolidCompression=yes +OutputDir=./installer/ +SourceDir=dist +SetupIconFile=../installer.ico +UninstallDisplayIcon=../amdicon.ico +; license file needs to be build/all dir +;LicenseFile=../license.txt +OutputBaseFilename=Allmydata_Tahoe_Setup_v%(major)d_%(minor)d_%(point)d + +[Files] +; contents of 'binaries' dir. (consolidated build target) +Source: "*.*"; DestDir: "{app}\Install"; Flags: restartreplace replacesameversion uninsrestartdelete +Source: ".\web\*.*"; DestDir: "{app}\web"; Flags: recursesubdirs + +[Dirs] +Name: "{app}\noderoot" + +[Icons] +; Program files entries +Name: "{group}\Tahoe root dir (web)"; Filename: "{app}\Install\tahoe.exe"; Parameters: "webopen" +Name: "{group}\Allmydata Help"; Filename: "http://www.allmydata.com/help.php" + +[Run] +; Things performed before the final page of the installer +Filename: "{app}\Install\tahoesvc.exe"; Parameters: "-install"; Flags: runhidden +Filename: "{app}\Install\tahoe.exe"; Parameters: "create-client ""{app}\noderoot"""; Description: "Set the node into debug logging mode"; Flags: runhidden +Filename: "{app}\Install\confwiz.exe"; Flags: hidewizard +;Filename: "{app}\Install\ReadMe.txt"; Description: "View the ReadMe file"; Flags: unchecked postinstall nowait shellexec skipifdoesntexist + +[UninstallRun] +; Performed before the uninstaller runs to undo things +Filename: "{sys}\net.exe"; Parameters: "stop Tahoe"; Flags: runhidden +Filename: "{app}\Install\tahoesvc.exe"; Parameters: "-remove"; Flags: runhidden +;Filename: "http://www.allmydata.com/redirect/uninstallsurvey.php?build=%(build)%"; Flags: shellexec + +[Registry] +Root: HKLM; Subkey: "Software\Allmydata"; Flags: uninsdeletekeyifempty +Root: HKLM; Subkey: "Software\Allmydata"; ValueType: string; ValueName: "Base Dir Path"; ValueData: "{app}\noderoot"; Flags: uninsdeletekey