Permalink
Browse files

support: rename custom distutils classes to match their 'command name'

  • Loading branch information...
1 parent e92bb40 commit 0d0dbc75f32e5e65da7484f1a0fce3038d973afc @strohel committed Oct 11, 2011
Showing with 13 additions and 11 deletions.
  1. +8 −6 support/dist.py
  2. +3 −3 support/dist_cmd_build.py
  3. +1 −1 support/dist_cmd_build_prepare.py
  4. +1 −1 support/dist_cmd_test.py
View
@@ -11,9 +11,9 @@
import distutils.log as log
from distutils.util import strtobool
-from dist_cmd_build import PyBayesBuild
-from dist_cmd_build_prepare import PyBayesBuildPrepare
-from dist_cmd_test import PyBayesTest
+from dist_cmd_build import build
+from dist_cmd_build_prepare import build_prepare
+from dist_cmd_test import test
class PyBayesDistribution(Distribution):
@@ -25,7 +25,10 @@ def __init__(self, attrs=None):
self.profile = False
if not self.ext_modules:
self.ext_modules = []
- self.cmdclass['test'] = PyBayesTest
+
+ # it is better to define command classes here, so it available in --help text
+ self.cmdclass['test'] = test
+ self.cmdclass['build_prepare'] = build_prepare
self.global_options += [
('use-cython=', None, "use Cython to make faster binary python modules (choices: "
@@ -70,8 +73,7 @@ def finalize_command_line(self):
self.finalize_cython_options()
def finalize_cython_options(self):
- self.cmdclass['build'] = PyBayesBuild
- self.cmdclass['build_prepare'] = PyBayesBuildPrepare
+ self.cmdclass['build'] = build
self.cmdclass['build_ext'] = self.build_ext
# .pyc files just litter site-packages in Cython build
@@ -6,14 +6,14 @@
An extension distutils' build to handle Python/Cython build of PyBayes
"""
-from distutils.command.build import build
+from distutils.command.build import build as orig_build
-class PyBayesBuild(build):
+class build(orig_build):
"""Introduce additional build step to inject Cython extensions"""
def finalize_options(self):
- build.finalize_options(self)
+ orig_build.finalize_options(self)
# prepend our custom command
self.sub_commands = [('build_prepare', None)] + self.sub_commands
self.build_lib = self.build_platlib
@@ -15,7 +15,7 @@
import string
-class PyBayesBuildPrepare(Command):
+class build_prepare(Command):
"""Additional build step that is used to add Cython Extension per each module that is specified"""
def initialize_options(self):
View
@@ -14,7 +14,7 @@
import unittest
-class PyBayesTest(Command):
+class test(Command):
"""Test PyBayes in the build directory"""
description = 'run unit test-suite of PyBayes within build directory'

0 comments on commit 0d0dbc7

Please sign in to comment.