Skip to content

Instantly share code, notes, and snippets.

@theodox
Created December 22, 2016 23:14
Show Gist options
  • Save theodox/b2b6f6d99285aa0ccab4e63453df4d94 to your computer and use it in GitHub Desktop.
Save theodox/b2b6f6d99285aa0ccab4e63453df4d94 to your computer and use it in GitHub Desktop.
takes some of the typing out of compiling a Python27 exe using Cython. Expects that you've got https://www.microsoft.com/en-us/download/details.aspx?id=44266 installed
import os
import sys
import subprocess
PYHOME = os.environ.get("PY27", "C:\\ul\\tools\\python\\python27\\")
PYLIB = PYHOME + "libs"
PYINC = PYHOME + "include"
subprocess.call(("cython", sys.argv[-1], "--embed" ))
scriptfile = sys.argv[-1].replace(".pyx", ".py").replace(".py", ".c")
args = "cl.exe", "/I", PYINC, scriptfile
os.environ["LINK"] = "/LIBPATH:"+PYLIB
print args
subprocess.call(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment