Skip to content

Commit 9143b54

Browse files
committed
Rename build classes, and PLATFORM to ARCH
1 parent 67c1612 commit 9143b54

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

setup.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
CONFIG = "Release" # Release or Debug
2424
DEVTOOLS = "MsDev" if sys.platform == "win32" else "Mono"
2525
VERBOSITY = "minimal" # quiet, minimal, normal, detailed, diagnostic
26-
PLATFORM = "x64" if architecture()[0] == "64bit" else "x86"
26+
ARCH = "x64" if architecture()[0] == "64bit" else "x86"
2727

2828

2929
def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
@@ -41,7 +41,7 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
4141
if use_windows_sdk:
4242
sdks_root = r"SOFTWARE\Microsoft\Microsoft SDKs\Windows"
4343
kits_root = r"SOFTWARE\Microsoft\Windows Kits\Installed Roots"
44-
kits_suffix = os.path.join("bin", PLATFORM)
44+
kits_suffix = os.path.join("bin", ARCH)
4545
keys_to_check.extend([
4646
("Windows Kit 10.0", kits_root, "KitsRoot10", kits_suffix),
4747
("Windows Kit 8.1", kits_root, "KitsRoot81", kits_suffix),
@@ -91,7 +91,7 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
9191
if use_windows_sdk:
9292
localappdata = os.environ["LOCALAPPDATA"]
9393
pywinsdk = localappdata + r"\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin"
94-
if PLATFORM == "x64":
94+
if ARCH == "x64":
9595
pywinsdk += r"\x64"
9696
paths_to_check.append(("Visual C++ for Python", pywinsdk))
9797

@@ -119,7 +119,7 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
119119
"DevTools %s not supported (use MsDev or Mono)" % DEVTOOLS)
120120

121121

122-
class PythonNET_BuildExt(build_ext):
122+
class BuildExtPythonnet(build_ext):
123123
def build_extension(self, ext):
124124
"""Builds the .pyd file using msbuild or xbuild"""
125125
if ext.name != "clr":
@@ -185,7 +185,7 @@ def build_extension(self, ext):
185185
_xbuild,
186186
"pythonnet.sln",
187187
"/p:Configuration=%s" % _config,
188-
"/p:Platform=%s" % PLATFORM,
188+
"/p:Platform=%s" % ARCH,
189189
"/p:DefineConstants=\"%s\"" % _defines_sep.join(defines),
190190
"/p:PythonBuildDir=\"%s\"" % os.path.abspath(dest_dir),
191191
"/p:PythonInteropFile=\"%s\"" % os.path.basename(interop_file),
@@ -250,7 +250,7 @@ def _install_packages(self):
250250
check_call(cmd, shell=use_shell)
251251

252252

253-
class PythonNET_InstallLib(install_lib):
253+
class InstallLibPythonnet(install_lib):
254254
def install(self):
255255
if not os.path.isdir(self.build_dir):
256256
self.warn("'%s' does not exist -- no Python modules to install" %
@@ -262,16 +262,18 @@ def install(self):
262262

263263
# only copy clr.pyd/.so
264264
for srcfile in glob(os.path.join(self.build_dir, "clr.*")):
265-
destfile = os.path.join(self.install_dir, os.path.basename(srcfile))
265+
destfile = os.path.join(
266+
self.install_dir, os.path.basename(srcfile))
266267
self.copy_file(srcfile, destfile)
267268

268269

269-
class PythonNET_InstallData(install_data):
270+
class InstallDataPythonnet(install_data):
270271
def run(self):
271272
build_cmd = self.get_finalized_command("build_ext")
272273
install_cmd = self.get_finalized_command("install")
273274
build_lib = os.path.abspath(build_cmd.build_lib)
274-
install_platlib = os.path.relpath(install_cmd.install_platlib, self.install_dir)
275+
install_platlib = os.path.relpath(
276+
install_cmd.install_platlib, self.install_dir)
275277

276278
for i, data_files in enumerate(self.data_files):
277279
if isinstance(data_files, str):
@@ -313,7 +315,8 @@ def _get_interop_filename():
313315
sources.extend(glob("*" + ext))
314316

315317
for root, dirnames, filenames in os.walk("src"):
316-
for ext in (".cs", ".csproj", ".sln", ".snk", ".config", ".il", ".py", ".c", ".h", ".ico"):
318+
for ext in (".cs", ".csproj", ".sln", ".snk", ".config", ".il",
319+
".py", ".c", ".h", ".ico"):
317320
for filename in fnmatch.filter(filenames, "*" + ext):
318321
sources.append(os.path.join(root, filename))
319322

@@ -360,9 +363,9 @@ def _get_interop_filename():
360363
],
361364
zip_safe=False,
362365
cmdclass={
363-
"build_ext": PythonNET_BuildExt,
364-
"install_lib": PythonNET_InstallLib,
365-
"install_data": PythonNET_InstallData,
366+
"build_ext": BuildExtPythonnet,
367+
"install_lib": InstallLibPythonnet,
368+
"install_data": InstallDataPythonnet,
366369
},
367370
setup_requires=setup_requires
368371
)

0 commit comments

Comments
 (0)