Commit 67077122 authored by Christoph Groth's avatar Christoph Groth
Browse files

setup.py: remove our_ prefix for distutils commands

parent 158fb875
...@@ -19,8 +19,8 @@ import configparser ...@@ -19,8 +19,8 @@ import configparser
from setuptools import setup, Extension, Command from setuptools import setup, Extension, Command
from sysconfig import get_platform from sysconfig import get_platform
from distutils.errors import DistutilsError, DistutilsModuleError from distutils.errors import DistutilsError, DistutilsModuleError
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext as build_ext_orig
from setuptools.command.sdist import sdist from setuptools.command.sdist import sdist as sdist_orig
try: try:
from os.path import samefile from os.path import samefile
...@@ -218,18 +218,18 @@ def long_description(): ...@@ -218,18 +218,18 @@ def long_description():
return ''.join(text) return ''.join(text)
class our_build_ext(build_ext): class build_ext(build_ext_orig):
def run(self): def run(self):
with open(os.path.join('src', 'version.hh'), 'w') as f: with open(os.path.join('src', 'version.hh'), 'w') as f:
f.write("// This file has been generated by setup.py.\n") f.write("// This file has been generated by setup.py.\n")
f.write("// It is not included in source distributions.\n") f.write("// It is not included in source distributions.\n")
f.write('#define VERSION "{}"\n'.format(version)) f.write('#define VERSION "{}"\n'.format(version))
build_ext.run(self) build_ext_orig.run(self)
class our_sdist(sdist): class sdist(sdist_orig):
def make_release_tree(self, base_dir, files): def make_release_tree(self, base_dir, files):
sdist.make_release_tree(self, base_dir, files) sdist_orig.make_release_tree(self, base_dir, files)
fname = os.path.join(base_dir, SAVED_VERSION_FILE) fname = os.path.join(base_dir, SAVED_VERSION_FILE)
# This could be a hard link, so try to delete it first. Is there any way # This could be a hard link, so try to delete it first. Is there any way
...@@ -280,8 +280,8 @@ def main(): ...@@ -280,8 +280,8 @@ def main():
license="Simplified BSD license", license="Simplified BSD license",
platforms=["Unix", "Linux", "Mac OS-X", "Windows"], platforms=["Unix", "Linux", "Mac OS-X", "Windows"],
classifiers=classifiers.split('\n'), classifiers=classifiers.split('\n'),
cmdclass={'build_ext': our_build_ext, cmdclass={'build_ext': build_ext,
'sdist': our_sdist}, 'sdist': sdist},
ext_modules=[Extension(name, **kwargs) ext_modules=[Extension(name, **kwargs)
for name, kwargs in exts.items()], for name, kwargs in exts.items()],
setup_requires=['pytest-runner'], setup_requires=['pytest-runner'],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment