Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fabioz/py_compile_win_helpers

Helpers to setup the environment to compile extensions for Python.
https://github.com/fabioz/py_compile_win_helpers

Last synced: 27 days ago
JSON representation

Helpers to setup the environment to compile extensions for Python.

Awesome Lists containing this project

README

        

# py_compile_win_helpers

Helpers to setup the environment to compile extensions for Python.

It's meant to be used in Python code to automate getting a library and building
it as an extension module without relying on the current env.

It should take care of env variables such as MSSdk, DISTUTILS_USE_SDK, finding
the compiler and executing vcvarsall or SetEnv as needed.

Example:

def main():
subprocess.check_call(['git', 'clone', 'some_repo'])
import py_compile_win_helpers
env = py_compile_win_helpers.get_compile_env()
subprocess.check_call(['python', 'setup.py', 'clean'], env=env, cwd=os.path.join('some_repo'))
subprocess.check_call(['python', 'setup.py', 'build'], env=env, cwd=os.path.join('some_repo'))

It's also possible to get it for another python executable:

def main():
subprocess.check_call(['git', 'clone', 'some_repo'])
import py_compile_win_helpers
env = py_compile_win_helpers.get_compile_env(py_32_64)
subprocess.check_call([py_32_64, 'setup.py', 'clean'], env=env, cwd=os.path.join('some_repo'))
subprocess.check_call([py_32_64, 'setup.py', 'bdist_egg'], env=env, cwd=os.path.join('some_repo'))

Can be installed with:

pip install py_compile_win_helpers

# Requisites

For Python 2.6 and 2.7, Microsoft Visual C++ Compiler for Python 2.7 is needed.
-- https://www.microsoft.com/en-us/download/details.aspx?id=44266

For Python 3.3 and 3.4, Visual Studio 2010 Express is needed.

For Python 3.5 and 3.6, Visual Studio 2015 is needed.

-- Note, older versions can be found at https://www.visualstudio.com/vs/older-downloads/
but you need to register with Microsoft (free) to be able to find downloads for older versions of Visual Studio

https://wiki.python.org/moin/WindowsCompilers can be of help too.