aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2016-02-24 01:13:08 -0500
committerTim Harder <radhermit@gmail.com>2016-02-24 01:14:44 -0500
commitb92f81a5db210a5a45a9736ff2bad2a51e71913c (patch)
tree9a23dce6524f658d7aff6cb4e0e93a5dcd000df7
parentpinspect: use description instead of help for overarching subparsers info (diff)
downloadpkgcore-b92f81a5db210a5a45a9736ff2bad2a51e71913c.tar.gz
pkgcore-b92f81a5db210a5a45a9736ff2bad2a51e71913c.tar.bz2
pkgcore-b92f81a5db210a5a45a9736ff2bad2a51e71913c.zip
setup: move build command to pkgdist
-rw-r--r--pkgdist.py53
-rwxr-xr-xsetup.py34
2 files changed, 44 insertions, 43 deletions
diff --git a/pkgdist.py b/pkgdist.py
index 8a7f5795e..db9991963 100644
--- a/pkgdist.py
+++ b/pkgdist.py
@@ -13,6 +13,7 @@ import errno
import inspect
import io
import math
+import operator
import os
import re
import shlex
@@ -45,15 +46,22 @@ def find_project(topdir=TOPDIR):
module.
"""
topdir_depth = len(topdir.split('/'))
+ modules = []
# look for a top-level module
for root, dirs, files in os.walk(topdir):
+ # only descend at most one level
if len(root.split('/')) > topdir_depth + 1:
continue
if '__init__.py' in files:
- return os.path.basename(root)
+ modules.append(os.path.basename(root))
- raise ValueError('No project module found')
+ if not modules:
+ raise ValueError('No project module found')
+ elif len(modules) > 1:
+ raise ValueError('Multiple project modules found: %s' % (', '.join(modules)))
+
+ return modules[0]
# determine the project we're being imported into
@@ -210,15 +218,7 @@ class build_py(dst_build_py.build_py):
from lib2to3 import refactor as ref_mod
from snakeoil.dist import caching_2to3
- if ((sys.version_info >= (3, 0) and sys.version_info < (3, 1, 2)) or
- (sys.version_info >= (2, 6) and sys.version_info < (2, 6, 5))):
- if proc_count not in (0, 1):
- log.warn(
- "disabling parallelization: you're running a python version "
- "with a broken multiprocessing.queue.JoinableQueue.put "
- "(python bug 4660).")
- proc_count = 1
- elif proc_count == 0:
+ if proc_count == 0:
import multiprocessing
proc_count = multiprocessing.cpu_count()
@@ -464,6 +464,37 @@ class build_scripts(dst_build_scripts.build_scripts):
self.copy_scripts()
+class build(dst_build.build):
+
+ user_options = dst_build.build.user_options[:]
+ user_options.append(('enable-man-pages', None, 'build man pages'))
+ user_options.append(('enable-html-docs', None, 'build html docs'))
+
+ boolean_options = dst_build.build.boolean_options[:]
+ boolean_options.extend(['enable-man-pages', 'enable-html-docs'])
+
+ sub_commands = dst_build.build.sub_commands[:]
+ sub_commands.append(('build_ext', None))
+ sub_commands.append(('build_py', None))
+ sub_commands.append(('build_scripts', None))
+ sub_commands.append(('build_docs', operator.attrgetter('enable_html_docs')))
+ sub_commands.append(('build_man', operator.attrgetter('enable_man_pages')))
+
+ def initialize_options(self):
+ dst_build.build.initialize_options(self)
+ self.enable_man_pages = False
+ self.enable_html_docs = False
+
+ def finalize_options(self):
+ dst_build.build.finalize_options(self)
+ if self.enable_man_pages is None:
+ path = os.path.dirname(os.path.abspath(__file__))
+ self.enable_man_pages = not os.path.exists(os.path.join(path, 'man'))
+
+ if self.enable_html_docs is None:
+ self.enable_html_docs = False
+
+
class install_docs(Command):
"""Install html documentation."""
diff --git a/setup.py b/setup.py
index e08c0a321..00db2cd6e 100755
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,6 @@ import subprocess
import sys
from distutils import log
-from distutils.command.build import build
from distutils.errors import DistutilsExecError
from distutils.util import byte_compile
from setuptools import setup, find_packages
@@ -44,35 +43,6 @@ class mysdist(pkgdist.sdist):
pkgdist.sdist.make_release_tree(self, base_dir, files)
-class pkgcore_build(build):
-
- user_options = build.user_options[:]
- user_options.append(('enable-man-pages', None, 'build man pages'))
- user_options.append(('enable-html-docs', None, 'build html docs'))
-
- boolean_options = build.boolean_options[:]
- boolean_options.extend(['enable-man-pages', 'enable-html-docs'])
-
- sub_commands = build.sub_commands[:]
- sub_commands.append(('build_scripts', None))
- sub_commands.append(('build_docs', operator.attrgetter('enable_html_docs')))
- sub_commands.append(('build_man', operator.attrgetter('enable_man_pages')))
-
- def initialize_options(self):
- build.initialize_options(self)
- self.enable_man_pages = False
- self.enable_html_docs = False
-
- def finalize_options(self):
- build.finalize_options(self)
- if self.enable_man_pages is None:
- path = os.path.dirname(os.path.abspath(__file__))
- self.enable_man_pages = not os.path.exists(os.path.join(path, 'man'))
-
- if self.enable_html_docs is None:
- self.enable_html_docs = False
-
-
_base_install = getattr(pkgdist, 'install', install.install)
@@ -222,14 +192,14 @@ if not pkgdist.is_py3k:
cmdclass = {
'sdist': mysdist,
- 'build': pkgcore_build,
+ 'build': pkgdist.build,
'build_py': pkgdist.build_py,
'build_ext': pkgdist.build_ext,
+ 'build_scripts': pkgdist.build_scripts,
'build_man': pkgdist.build_man,
'build_docs': pkgdist.build_docs,
'test': test,
'install': pkgcore_install,
- 'build_scripts': pkgdist.build_scripts,
'install_man': pkgdist.install_man,
'install_docs': pkgdist.install_docs,
}