diff options
author | Tim Harder <radhermit@gmail.com> | 2015-07-22 01:58:22 -0400 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2015-07-22 23:42:56 -0400 |
commit | 9369adf754045e7712db2539a1df9b401f2907e1 (patch) | |
tree | a67a81bb37fee667cff8b1d0b37a19182e1add03 | |
parent | Merge commit '59ce436cdabbf9e496ac59f0f4dac0cbaaf4554e' as 'pkgdist' (diff) | |
download | pkgcore-9369adf754045e7712db2539a1df9b401f2907e1.tar.gz pkgcore-9369adf754045e7712db2539a1df9b401f2907e1.tar.bz2 pkgcore-9369adf754045e7712db2539a1df9b401f2907e1.zip |
use setuptools explicitly with subtree-ed pkgdist module
This should allow setuptools setup.py dep parsing to work as expected.
-rw-r--r-- | MANIFEST.in | 1 | ||||
-rw-r--r-- | doc/conf.py | 4 | ||||
-rw-r--r-- | pkgcore/__init__.py | 2 | ||||
-rw-r--r-- | pkgcore/const.py | 1 | ||||
-rw-r--r-- | pkgcore/vdb/repo_ops.py | 4 | ||||
-rw-r--r-- | pkgcore/version.py | 13 | ||||
-rwxr-xr-x | setup.py | 65 | ||||
-rw-r--r-- | tox.ini | 7 |
8 files changed, 43 insertions, 54 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index 2af9e663e..c57131a1b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,5 +5,6 @@ recursive-include doc * recursive-include examples * recursive-include bash * recursive-include config * +recursive-include pkgdist * recursive-include src *.[ch] global-exclude *.pyc *.pyo __pycache__ diff --git a/doc/conf.py b/doc/conf.py index bde3ac7ec..70148694e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -22,7 +22,7 @@ import sys # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(1, os.path.abspath('..')) -from pkgcore.const import VERSION as pkgcore_version +from pkgcore import __version__ from pkgcore.sphinx_utils.generate_man_rsts import ManConverter @@ -81,7 +81,7 @@ copyright = '2006-2015, pkgcore contributors' # built documents. # # The short X.Y version. -version = pkgcore_version +version = __version__ # The full version, including alpha/beta/rc tags. release = 'trunk' diff --git a/pkgcore/__init__.py b/pkgcore/__init__.py index e698cf780..3c24fc18e 100644 --- a/pkgcore/__init__.py +++ b/pkgcore/__init__.py @@ -5,7 +5,7 @@ Pkgcore manager base module. """ -__all__ = () +__version__ = '0.9.2' # XXX yes; this location sucks, but we need some way to castrate the sandbox # if we're ever invoked w/in it. diff --git a/pkgcore/const.py b/pkgcore/const.py index 61b62afdc..05c6cf45d 100644 --- a/pkgcore/const.py +++ b/pkgcore/const.py @@ -35,7 +35,6 @@ HOST_ROOT_PATHS = ("/usr/local/sbin", "/usr/local/bin", "/usr/sbin", LIBFAKEROOT_PATH = "/usr/lib/libfakeroot.so" FAKED_PATH = "/usr/bin/faked" -VERSION = '0.9.2' def _GET_CONST(attr, default_value, allow_environment_override=False): consts = mappings.ProxiedAttrs(sys.modules[__name__]) diff --git a/pkgcore/vdb/repo_ops.py b/pkgcore/vdb/repo_ops.py index f28f9dd95..f57dac00f 100644 --- a/pkgcore/vdb/repo_ops.py +++ b/pkgcore/vdb/repo_ops.py @@ -10,7 +10,7 @@ from snakeoil import compression from snakeoil.demandload import demandload from snakeoil.osutils import ensure_dirs, pjoin, normpath -from pkgcore.const import VERSION +from pkgcore import __version__ from pkgcore.operations import repo as repo_ops demandload( @@ -115,7 +115,7 @@ class install(repo_ops.install): #finally, we mark who made this. with open(pjoin(dirpath, "PKGMANAGER"), "w") as f: - f.write("pkgcore-%s\n" % VERSION) + f.write("pkgcore-%s\n" % __version__) return True def finalize_data(self): diff --git a/pkgcore/version.py b/pkgcore/version.py index 3fa465f03..5996cb4f3 100644 --- a/pkgcore/version.py +++ b/pkgcore/version.py @@ -6,7 +6,7 @@ __all__ = ("get_version",) -from pkgcore import const +from pkgcore import __version__ _ver = None @@ -16,11 +16,12 @@ def _compatibility_version(): try: from pkgcore._verinfo import version_info except ImportError: - return "pkgcore %s\nUnknown vcs version" % (const.VERSION,) + return "pkgcore %s\nUnknown vcs version" % (__version__,) if not isinstance(version_info, str): - return ("pkgcore %s\ngit rev %s, date %s" % - (const.VERSION, version_info['rev'], version_info['date'])) - return "pkgcore %s\n%s" % (const.VERSION, version_info) + return ( + "pkgcore %s\ngit rev %s, date %s" % + (__version__, version_info['rev'], version_info['date'])) + return "pkgcore %s\n%s" % (__version__, version_info) def get_version(): """:return: a string describing the pkgcore version.""" @@ -33,5 +34,5 @@ def get_version(): if format_version is None: _ver = _compatibility_version() else: - _ver = format_version('pkgcore', __file__, const.VERSION) + _ver = format_version('pkgcore', __file__, __version__) return _ver @@ -1,26 +1,21 @@ #!/usr/bin/env python -import glob from itertools import chain import operator import os import subprocess +from stat import ST_MODE import sys -try: - from setuptools import Command, setup - from setuptools.command import install -except ImportError: - from distutils.core import Command, setup - from distutils.command import install - from distutils import log from distutils.command import build, build_scripts from distutils.errors import DistutilsExecError from distutils.util import byte_compile -from stat import ST_MODE -from snakeoil import distutils_extensions as snk_distutils +from setuptools import Command, setup +from setuptools.command import install + +from pkgdist import distutils_extensions as pkg_distutils # These offsets control where we install the pkgcore config files and the EBD # bits relative to the install-data path given to the install subcmd. @@ -32,23 +27,23 @@ EBD_INSTALL_OFFSET = 'lib/pkgcore' TOPDIR = os.path.dirname(os.path.abspath(__file__)) -class mysdist(snk_distutils.sdist): +class mysdist(pkg_distutils.sdist): """sdist command specifying the right files and generating ChangeLog.""" - user_options = snk_distutils.sdist.user_options + [ + user_options = pkg_distutils.sdist.user_options + [ ('build-docs', None, 'build docs [default]'), ('no-build-docs', None, 'do not build docs'), ] - boolean_options = snk_distutils.sdist.boolean_options + ['build-docs'] + boolean_options = pkg_distutils.sdist.boolean_options + ['build-docs'] package_namespace = 'pkgcore' - negative_opt = snk_distutils.sdist.negative_opt.copy() + negative_opt = pkg_distutils.sdist.negative_opt.copy() negative_opt.update({'no-build-docs': 'build-docs'}) def initialize_options(self): - snk_distutils.sdist.initialize_options(self) + pkg_distutils.sdist.initialize_options(self) self.build_docs = True def make_release_tree(self, base_dir, files): @@ -70,7 +65,7 @@ class mysdist(snk_distutils.sdist): import shutil shutil.copytree(os.path.join(cwd, "build/sphinx/man"), os.path.join(base_dir, "man")) - snk_distutils.sdist.make_release_tree(self, base_dir, files) + pkg_distutils.sdist.make_release_tree(self, base_dir, files) class pkgcore_build_scripts(build_scripts.build_scripts): @@ -248,7 +243,7 @@ class pkgcore_install_docs(Command): def calculate_install_path(self): return os.path.join( - self.prefix, 'share', 'doc', 'pkgcore-%s' % version, 'html') + self.prefix, 'share', 'doc', 'pkgcore-%s' % __version__, 'html') def find_content(self): for possible_path in self.content_search_path: @@ -319,7 +314,7 @@ class pkgcore_install_man(pkgcore_install_docs): d[x] = 'man%s/%s' % (x[-1], os.path.basename(x)) return d -_base_install = getattr(snk_distutils, 'install', install.install) +_base_install = getattr(pkg_distutils, 'install', install.install) class pkgcore_install(_base_install): @@ -423,13 +418,13 @@ def write_pkgcore_lookup_configs(python_base, install_prefix, injected_bin_path= byte_compile([path], optimize=2, prefix=python_base) -class pkgcore_build_py(snk_distutils.build_py): +class pkgcore_build_py(pkg_distutils.build_py): package_namespace = 'pkgcore' generate_verinfo = True -class test(snk_distutils.test): +class test(pkg_distutils.test): default_test_namespace = 'pkgcore.test' @@ -441,7 +436,7 @@ class test(snk_distutils.test): original = os.environ.get(key) try: os.environ[key] = os.path.dirname(os.path.realpath(__file__)) - return snk_distutils.test.run(self) + return pkg_distutils.test.run(self) finally: if original is not None: os.environ[key] = original @@ -458,30 +453,30 @@ def _find_modules(location): packages = _find_modules('pkgcore') extensions = [] -if not snk_distutils.is_py3k: +if not pkg_distutils.is_py3k: extensions.extend([ - snk_distutils.OptionalExtension( + pkg_distutils.OptionalExtension( 'pkgcore.ebuild._atom', ['src/atom.c']), - snk_distutils.OptionalExtension( + pkg_distutils.OptionalExtension( 'pkgcore.ebuild._cpv', ['src/cpv.c']), - snk_distutils.OptionalExtension( + pkg_distutils.OptionalExtension( 'pkgcore.ebuild._depset', ['src/depset.c']), - snk_distutils.OptionalExtension( + pkg_distutils.OptionalExtension( 'pkgcore.ebuild._filter_env', [ 'src/filter_env.c', 'src/bmh_search.c']), - snk_distutils.OptionalExtension( + pkg_distutils.OptionalExtension( 'pkgcore.restrictions._restrictions', ['src/restrictions.c']), - snk_distutils.OptionalExtension( + pkg_distutils.OptionalExtension( 'pkgcore.ebuild._misc', ['src/misc.c']), ]) -from pkgcore.const import VERSION as version +from pkgcore import __version__ cmdclass = { 'sdist': mysdist, 'build': pkgcore_build, 'build_py': pkgcore_build_py, - 'build_ext': snk_distutils.build_ext, + 'build_ext': pkg_distutils.build_ext, 'test': test, 'install': pkgcore_install, 'build_scripts': pkgcore_build_scripts, @@ -494,16 +489,16 @@ command_options = {} # All versions of snakeoil past 0.4.6 now return a class # by default, that is a failure if invoked; this code is # left in place for <=0.4.6 compatibility. -BuildDoc = snk_distutils.sphinx_build_docs() +BuildDoc = pkg_distutils.sphinx_build_docs() if BuildDoc: cmdclass['build_docs'] = BuildDoc command_options['build_docs'] = { - 'version': ('setup.py', version), + 'version': ('setup.py', __version__), 'source_dir': ('setup.py', 'doc'), } cmdclass['build_man'] = BuildDoc command_options['build_man'] = { - 'version': ('setup.py', version), + 'version': ('setup.py', __version__), 'source_dir': ('setup.py', 'doc'), 'builder': ('setup.py', 'man'), } @@ -513,7 +508,7 @@ with open('README.rst', 'r') as f: setup( name='pkgcore', - version=version, + version=__version__, description='package managing framework', long_description=readme, url='https://github.com/pkgcore/pkgcore', @@ -521,7 +516,7 @@ setup( author='Brian Harring, Tim Harder', author_email='pkgcore-dev@googlegroups.com', packages=packages, - requires=['snakeoil (>=0.6.4)'], + install_requires=['snakeoil>=0.6.4'], data_files=list(chain( _get_data_mapping(CONFIG_INSTALL_OFFSET, 'config'), _get_data_mapping(EBD_INSTALL_OFFSET, 'bash'), @@ -1,7 +1,5 @@ [tox] envlist = py27, py33, py34 -# snakeoil is required for sdist which runs before deps are installed -skipsdist = True [testenv] whitelist_externals = cp skip_install = True @@ -13,9 +11,7 @@ deps = pytest-xdist pytest-cov mock - https://github.com/pkgcore/snakeoil/archive/master.tar.gz commands = - pip install -I "{toxinidir}" cp "{toxinidir}/.coveragerc" "{envsitepackagesdir}" py.test {posargs:-n 4 --cov pkgcore pkgcore/test} @@ -27,9 +23,7 @@ setenv = deps = sphinx pyparsing - https://github.com/pkgcore/snakeoil/archive/master.tar.gz commands = - pip install -I . make -C doc {posargs:man html} # stub for travis-ci python nightly target tests @@ -37,6 +31,5 @@ commands = # override commands so pytest-xdist isn't used since one of its deps # (execnet) doesn't appear to be working on py35 yet commands = - pip install -I "{toxinidir}" cp "{toxinidir}/.coveragerc" "{envsitepackagesdir}" py.test {posargs:--cov pkgcore pkgcore/test} |