From 7ba2b0d3cf58f5f759aec224fad2030d1537ae1e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 22 Nov 2010 15:37:35 -0700 Subject: [PATCH] Update windows binary build to use python 2.7 --- setup/installer/windows/freeze.py | 2 +- setup/installer/windows/notes.rst | 4 ++-- src/calibre/startup.py | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/setup/installer/windows/freeze.py b/setup/installer/windows/freeze.py index dc3dd33604..118b6690f0 100644 --- a/setup/installer/windows/freeze.py +++ b/setup/installer/windows/freeze.py @@ -132,7 +132,7 @@ class Win32Freeze(Command, WixMixIn): shutil.copytree(self.j(comext, 'shell'), self.j(sp_dir, 'win32com', 'shell')) shutil.rmtree(comext) - for pat in (r'numpy', r'PyQt4\uic\port_v3'): + for pat in (r'PyQt4\uic\port_v3', ): x = glob.glob(self.j(self.lib_dir, 'site-packages', pat))[0] shutil.rmtree(x) diff --git a/setup/installer/windows/notes.rst b/setup/installer/windows/notes.rst index 281cd8668e..45aa4d2afb 100644 --- a/setup/installer/windows/notes.rst +++ b/setup/installer/windows/notes.rst @@ -19,7 +19,7 @@ Set CMAKE_PREFIX_PATH environment variable to C:\cygwin\home\kovid\sw This is where all dependencies will be installed. -Add C:\Python26\Scripts and C:\Python26 to PATH +Add C:\Python27\Scripts and C:\Python27 to PATH Install setuptools from http://pypi.python.org/pypi/setuptools If there are no windows binaries already compiled for the version of python you are using then download the source and run the following command in the folder where the source has been unpacked:: @@ -28,7 +28,7 @@ If there are no windows binaries already compiled for the version of python you Run the following command to install python dependencies:: - easy_install --always-unzip -U ipython mechanize pyreadline python-dateutil dnspython cssutils clientform + easy_install --always-unzip -U ipython mechanize pyreadline python-dateutil dnspython cssutils clientform pycrypto Install BeautifulSoup 3.0.x manually into site-packages (3.1.x parses broken HTML very poorly) diff --git a/src/calibre/startup.py b/src/calibre/startup.py index e384153993..e74660d0bc 100644 --- a/src/calibre/startup.py +++ b/src/calibre/startup.py @@ -129,7 +129,7 @@ if not _run_once: def __getattribute__(self, attr): if attr in ('name', '__enter__', '__str__', '__unicode__', - '__repr__'): + '__repr__', '__exit__'): return object.__getattribute__(self, attr) fobject = object.__getattribute__(self, 'fobject') return getattr(fobject, attr) @@ -155,6 +155,11 @@ if not _run_once: fobject.__enter__() return self + def __exit__(self, *args): + fobject = object.__getattribute__(self, 'fobject') + return fobject.__exit__(*args) + + m = mode[0] random = len(mode) > 1 and mode[1] == '+' binary = mode[-1] == 'b'