Skip to content

Commit

Permalink
Another try to fix hen/egg problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Wilhelm authored and Florian Wilhelm committed Jul 6, 2015
1 parent 854c14a commit 541de33
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 78 deletions.
2 changes: 1 addition & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Configuration
Projects set up with PyScaffold feature an easy package configuration with
``setup.cfg``. Here is an example of PyScaffold's own ``setup.cfg``:

.. literalinclude:: ../setup.cfg
.. literalinclude:: /example_setup.cfg
2 changes: 1 addition & 1 deletion pyscaffold/data/setup_cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ packages =
# Specify command line options as you would do when invoking py.test directly.
# e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml
# in order to write a coverage file that can be read by Jenkins.
addopts = tests
addopts =
--cov ${package} --cov-report term-missing
--verbose

Expand Down
2 changes: 1 addition & 1 deletion pyscaffold/data/setup_py.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from setuptools import setup
def setup_package():
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []
setup(setup_requires=['six', 'PyScaffold>=2.3rc1,<2.4'] + pytest_runner,
setup(setup_requires=['six', 'pyscaffold>=2.3rc1,<2.4'] + pytest_runner,
tests_require=['pytest_cov', 'pytest'],
use_pyscaffold=True)

Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
six
setuptools>=9.0
pbr>=1.2,<1.3
setuptools_scm>=1.5,<1.6
57 changes: 1 addition & 56 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,56 +1,5 @@
[metadata]
name = PyScaffold
summary = Tool for easily putting up the scaffold of a Python project
author = Florian Wilhelm
author-email = Florian.Wilhelm@blue-yonder.com
license = new BSD
home-page = http://pyscaffold.readthedocs.org/
description-file = README.rst
# Add here all kinds of additional classifiers as defined under
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers = Development Status :: 5 - Production/Stable,
Topic :: Utilities,
Programming Language :: Python,
Programming Language :: Python :: 2,
Programming Language :: Python :: 2.7,
Programming Language :: Python :: 3,
Programming Language :: Python :: 3.3,
Programming Language :: Python :: 3.4,
Environment :: Console,
Intended Audience :: Developers,
License :: OSI Approved :: BSD License,
Operating System :: POSIX :: Linux,
Operating System :: Unix,
Operating System :: MacOS,
Operating System :: Microsoft :: Windows

[entry_points]
console_scripts =
putup = pyscaffold.cli:run
distutils.setup_keywords =
use_pyscaffold = pyscaffold.integration:pyscaffold_keyword
setuptools.file_finders =
setuptools_scm = pyscaffold.integration:find_files

[files]
packages =
pyscaffold
data_files =
share/pyscaffold = docs/*

[extras]
# Add here additional requirements for extra features, like:
# PDF = ReportLab>=1.2, RXP
ALL =
django
cookiecutter

[pytest]
# Options for py.test:
# Specify command line options as you would do when invoking py.test directly.
# e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml
# in order to write a coverage file that can be read by Jenkins.
addopts = tests
addopts =
--cov pyscaffold --cov-report term-missing
--verbose

Expand All @@ -59,7 +8,3 @@ test = pytest

[bdist_wheel]
universal = 1

[global]
# This is only needed for bootstrapping PyScaffold itself
setup-hooks = pyscaffold.integration.setup_hook
84 changes: 71 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import sys
from distutils.cmd import Command

from setuptools import setup, Distribution
from setuptools import setup, Distribution, find_packages

__author__ = "Florian Wilhelm"
__copyright__ = "Blue Yonder"
Expand All @@ -38,12 +38,38 @@ def initialize_options(self):
return BuildDoc


def setup_package():
# Install our dependencies directly since we need them now
dist = Distribution()
dist.fetch_build_eggs(['six', 'setuptools_scm>=1.5,<1.6', 'pbr>=1.2,<1.3'])
from pbr.util import cfg_to_args
def read(fname):
with open(os.path.join(__location__, fname)) as fh:
content = fh.read()
return content


def version2str(version):
if version.exact or not version.distance > 0:
return version.format_with('{tag}')
else:
distance = version.distance
version = str(version.tag)
if '.dev' in version:
version, tail = version.rsplit('.dev', 1)
assert tail == '0', 'own dev numbers are unsupported'
return '{}.post0.dev{}'.format(version, distance)


def local_version2str(version):
if version.exact:
if version.dirty:
return version.format_with('+dirty')
else:
return ''
else:
if version.dirty:
return version.format_with('+{node}.dirty')
else:
return version.format_with('+{node}')


def setup_package():
docs_path = os.path.join(__location__, 'docs')
docs_build_path = os.path.join(docs_path, '_build')
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
Expand All @@ -57,13 +83,45 @@ def setup_package():
'source_dir': ('setup.py', docs_path),
'builder': ('setup.py', 'doctest')}
}
kwargs = cfg_to_args()
kwargs['setup_requires'] = ['six'] + pytest_runner
kwargs['tests_require'] = ['pytest-cov', 'pytest']
kwargs['cmdclass'] = {'docs': build_cmd_docs(),
'doctest': build_cmd_docs()}
kwargs['command_options'] = command_options
setup(**kwargs)
entry_points={
'console_scripts': ['putup=pyscaffold.cli:run'],
'distutils.setup_keywords':
['use_pyscaffold = pyscaffold.integration:pyscaffold_keyword'],
'setuptools.file_finders':
['setuptools_scm=pyscaffold.integration:find_files']
}
setup(name='pyscaffold',
url='http://pyscaffold.readthedocs.org/',
author='Florian Wilhelm',
author_email='florian.wilhelm@blue-yonder.com',
description='Tool for easily putting up the scaffold of a '
'Python project',
long_description=read('README.rst'),
license='new BSD',
classifiers=['Development Status :: 5 - Production/Stable',
'Topic :: Utilities',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX :: Linux',
'Operating System :: Unix',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows'],
setup_requires=['six', 'setuptools_scm'] + pytest_runner,
tests_require=['pytest-cov', 'pytest'],
package_data={'pyscaffold': ['data/*']},
cmdclass={'docs': build_cmd_docs(), 'doctest': build_cmd_docs()},
command_options=command_options,
entry_points=entry_points,
packages=find_packages(exclude=['tests', 'tests.*']),
use_scm_version={'version_scheme': version2str,
'local_scheme': local_version2str})


if __name__ == '__main__':
Expand Down
Empty file removed tests/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
from pyscaffold import cli

from .fixtures import git_mock, noconfgit_mock, nogit_mock, tmpdir # noqa
from fixtures import git_mock, noconfgit_mock, nogit_mock, tmpdir # noqa

__author__ = "Florian Wilhelm"
__copyright__ = "Blue Yonder"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pyscaffold import info, cli
from six import string_types

from .fixtures import git_mock, noconfgit_mock, nogit_mock, tmpdir # noqa
from fixtures import git_mock, noconfgit_mock, nogit_mock, tmpdir # noqa

__author__ = "Florian Wilhelm"
__copyright__ = "Blue Yonder"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from pyscaffold.shell import git
from pyscaffold.utils import chdir

from .fixtures import tmpdir # noqa
from fixtures import tmpdir # noqa

__author__ = "Florian Wilhelm"
__copyright__ = "Blue Yonder"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from pyscaffold import repo, structure

from .fixtures import tmpdir # noqa
from fixtures import tmpdir # noqa

__author__ = "Florian Wilhelm"
__copyright__ = "Blue Yonder"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import six
from pyscaffold import cli, structure, utils

from .fixtures import nodjango_admin_mock, tmpdir # noqa
from fixtures import nodjango_admin_mock, tmpdir # noqa

__author__ = "Florian Wilhelm"
__copyright__ = "Blue Yonder"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pyscaffold import utils, templates
from pyscaffold.structure import create_structure

from .fixtures import tmpdir # noqa
from fixtures import tmpdir # noqa


def test_chdir():
Expand Down

0 comments on commit 541de33

Please sign in to comment.