Instructions for compiling pywin32 with VS 2015

This commit is contained in:
Kovid Goyal 2015-12-02 20:58:27 +05:30
parent c0cf5adfd8
commit ef8d72900e
2 changed files with 23 additions and 26 deletions

View File

@ -27,7 +27,7 @@ Cygwin
This is needed for automation of the build process, and the ease of use of the This is needed for automation of the build process, and the ease of use of the
unix shell (zsh). Install it by running: https://www.cygwin.com/setup-x86_64.exe unix shell (zsh). Install it by running: https://www.cygwin.com/setup-x86_64.exe
In cygwin, install vim, dos2unix, rsync, openssh, unzip, wget, make, zsh, bash-completion, curl In cygwin, install vim, dos2unix, rsync, openssh, unzip, wget, make, zsh, bash-completion, curl, patch
Run:: Run::
mkdir -p ~/sw/bin ~/sw/sources ~/sw/build ~/sw/lib ~/sw/private mkdir -p ~/sw/bin ~/sw/sources ~/sw/build ~/sw/lib ~/sw/private
@ -146,35 +146,29 @@ Add `source ~/.vcvars` to `~/.zshenv`
This will allow you to use the Visual Studio tools in the cygwin shell. This will allow you to use the Visual Studio tools in the cygwin shell.
Python packages setuptools
------------------ --------------
Download and extract setuptools from https://pypi.python.org/pypi/setuptools/
Install setuptools from http://pypi.python.org/pypi/setuptools. Use the source Run::
tarball. Edit setup.py and set zip_safe=False. Then run:: cd ~/sw/build/setuptools-* && sed -i.bak 's/zip_safe\s*=\s*True/zip_safe=False/' setup.py && \
python setup.py install python setup.py install
Run the following command to install python dependencies:: Miscellaneous python packages
--------------------------------------
easy_install --always-unzip -U mechanize python-dateutil dnspython cssutils clientform pycrypto pygments Run::
~/sw/private/python/Scripts/easy_install.exe --always-unzip -U python-dateutil dnspython mechanize pygments pyreadline cssutils pycrypto
Install pyreadline from https://pypi.python.org/pypi/pyreadline/2.0 pywin32
----------
Install pywin32 and edit win32com\__init__.py setting _frozen = True and Run::
__gen_path__ to a temp dir (otherwise it tries to set it to a dir in the
install tree which leads to permission errors)
Note that you should use::
import tempfile git clone --depth 1 https://github.com/kovidgoyal/pywin32.git
__gen_path__ = os.path.join( chmod +x swig/swig.exe
tempfile.gettempdir(), "gen_py", python setup.py -q build --plat-name=(win32|win-amd64) # Do this
"%d.%d" % (sys.version_info[0], sys.version_info[1])) # repeatedly until you stop getting .manifest file errors
python setup.py -q install
Use gettempdir instead of the win32 api method as gettempdir returns a temp dir
that is guaranteed to actually work.
Also edit win32com\client\gencache.py and change the except IOError on line 57
to catch all exceptions.
SQLite SQLite
--------- ---------

View File

@ -61,6 +61,7 @@ paths = env['path'].split(';')
lib = env['lib'] lib = env['lib']
include = env['include'] include = env['include']
libpath = env['libpath'] libpath = env['libpath']
sdkdir = env['windowssdkdir']
def unix(paths): def unix(paths):
up = [] up = []
@ -80,7 +81,9 @@ export INCLUDE="%s"
export LIBPATH="%s" export LIBPATH="%s"
'''%(unix(paths), lib.replace('\\', r'\\'), include.replace('\\', r'\\'), libpath.replace('\\', r'\\')) export WindowsSdkDir="%s"
'''%(unix(paths), lib.replace('\\', r'\\'), include.replace('\\', r'\\'), libpath.replace('\\', r'\\'), sdkdir.replace('\\', r'\\'))
print(raw.encode('utf-8')) print(raw.encode('utf-8'))