Zim

Merge lp:~bkidwell/zim/win32-build-0.61-fixes into lp:~jaap.karssenberg/zim/pyzim

Proposed by Brendan Kidwell
Status: Merged
Merged at revision: 694
Proposed branch: lp:~bkidwell/zim/win32-build-0.61-fixes
Merge into: lp:~jaap.karssenberg/zim/pyzim
Diff against target: 52 lines (+16/-6)
1 file modified
windows/build_win32.py (+16/-6)
To merge this branch: bzr merge lp:~bkidwell/zim/win32-build-0.61-fixes
Reviewer Review Type Date Requested Status
Jaap Karssenberg Pending
Review via email: mp+229697@code.launchpad.net

Description of the change

Jaap, I had to fix a couple of things in build_win32.py to get the build process to work right in Windows 7 with the Zim 0.61 release:

* Don't import __version__ from 'zim' package anymore; it gets all breaky trying to initialize the configuration data. Hackishly parse out this value by running a regex on zim/__init__.py .

* Use cmd.exe instead of shutil to clear windows/buid folder at the start of the build process; shutil was failing to delete the Microsoft.VC90.CRT subfolder.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'windows/build_win32.py'
2--- windows/build_win32.py 2012-04-04 00:03:31 +0000
3+++ windows/build_win32.py 2014-08-05 21:36:55 +0000
4@@ -13,14 +13,11 @@
5 import shutil
6 import glob
7 import datetime
8+import re
9 import subprocess
10 import distutils.dir_util
11 from distutils.sysconfig import get_python_lib
12
13-# load version number constant from zim package
14-sys.path.append(".")
15-from zim import __version__
16-
17 # contants for this script
18 #
19 # windows
20@@ -33,17 +30,30 @@
21 APP_ROOT = path.join(BUILD_ROOT, "ZimDesktopWikiPortable")
22 EXE_ROOT = path.join(APP_ROOT, r"App\ZimDesktopWiki")
23
24-#GTK_ROOT = path.join(get_python_lib(), r"gtk-2.0\runtime")
25+# Find GTK 'runtime' folder
26 for libdir in os.environ["PATH"].split(path.pathsep):
27 if path.exists(path.join(libdir, "libgtk-win32-2.0-0.dll")):
28 GTK_ROOT = path.dirname(libdir)
29
30+# Parse '__version__' out of zim package since simply importing __version__ from zim fails as of 0.61
31+f = open("zim/__init__.py", "r")
32+text = f.read()
33+f.close()
34+match = re.search(r"^\s*__version__\s*=\s*'([\d\.]+)'\s*$", text, re.MULTILINE)
35+__version__ = match.group(1)
36+
37 # --------------------------------------
38 # BUILD
39 # --------------------------------------
40
41 # Clean up and initialize the build directory
42-shutil.rmtree(BUILD_ROOT, True)
43+# (Use cmd.exe because shutil.rmtree seems to fail to delete "Microsoft.VC90.CRT" folder.)
44+if path.exists(BUILD_ROOT):
45+ subprocess.check_call([
46+ 'cmd.exe', '/c',
47+ 'cd', '/d', os.getcwd(), '&&',
48+ 'rmdir' , '/s', '/q', BUILD_ROOT
49+ ])
50 os.makedirs(EXE_ROOT)
51
52 # Create main zim.exe and any files generated by setup.py