Skip to content
This repository was archived by the owner on Jun 17, 2021. It is now read-only.

Commit 6b79465

Browse files
committed
Initial rename from d2to1 to setup.cfg
1 parent b9e75ba commit 6b79465

30 files changed

+76
-66
lines changed

setup.cfg

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[metadata]
2-
name = d2to1
3-
version = 0.2.12.dev
2+
name = setup.cfg
3+
version = 0.9.0.dev
44
author = Erik M. Bray
55
author-email = [email protected]
66
summary = Allows using distutils2-like setup.cfg files for a package's metadata with a distribute/setuptools setup.py
77
description-file =
88
README.rst
99
CHANGES.rst
10-
home-page = http://pypi.python.org/pypi/d2to1
10+
home-page = http://pypi.python.org/pypi/setup.cfg
1111
requires-dist = setuptools
1212
classifier =
1313
Development Status :: 5 - Production/Stable
@@ -24,8 +24,9 @@ classifier =
2424
2525
[files]
2626
packages =
27-
d2to1
28-
d2to1.extern
27+
setup
28+
setup.cfg
29+
setup.cfg.extern
2930
extra_files =
3031
CHANGES.rst
3132
LICENSE
@@ -37,18 +38,18 @@ tests-require = nose
3738
3839
[entry_points]
3940
distutils.setup_keywords =
40-
d2to1 = d2to1.core:d2to1
41+
setup_cfg = setup.cfg.core:setup_cfg
4142
zest.releaser.prereleaser.middle =
42-
d2_version = d2to1.zestreleaser:prereleaser_middle
43+
d2_version = setup.cfg.zestreleaser:prereleaser_middle
4344
zest.releaser.postreleaser.middle =
44-
d2_version = d2to1.zestreleaser:postreleaser_middle
45+
d2_version = setup.cfg.zestreleaser:postreleaser_middle
4546
4647
[test]
4748
test-suite = nose.collector
4849
4950
[zest.releaser]
5051
# These zest.releaser hooks are not installed as entry points as they are only
51-
# used for d2to1 itself--the ones that are installed as entry points are useful
52-
# to any project that uses d2to1
53-
releaser.middle = d2to1.zestreleaser.releaser_middle
54-
postreleaser.before = d2to1.zestreleaser.postreleaser_before
52+
# used for setup.cfg itself--the ones that are installed as entry points are
53+
# useful to any project that uses setup.cfg
54+
releaser.middle = setup.cfg.zestreleaser.releaser_middle
55+
postreleaser.before = setup.cfg.zestreleaser.postreleaser_before

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use_setuptools()
77
from setuptools import setup
88

9-
# d2to1 basically installs itself! See setup.cfg for the project metadata.
10-
from d2to1.util import cfg_to_args
9+
# setup.cfg basically installs itself! See setup.cfg for the project metadata.
10+
from setup.cfg.util import cfg_to_args
1111

1212

1313
setup(**cfg_to_args())
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
try:
2-
__version__ = __import__('pkg_resources').get_distribution('d2to1').version
2+
__version__ = __import__('pkg_resources').get_distribution('setup.cfg').version
33
except:
44
__version__ = ''
File renamed without changes.

d2to1/core.py renamed to setup/cfg/core.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
_Distribution = _get_unpatched(_Distribution)
1414

1515

16-
def d2to1(dist, attr, value):
17-
"""Implements the actual d2to1 setup() keyword. When used, this should be
18-
the only keyword in your setup() aside from `setup_requires`.
16+
def setup_cfg(dist, attr, value):
17+
"""
18+
Implements the actual setup_cfg setup() keyword. When used, this should be
19+
the only keyword in your setup() aside from ``setup_requires``.
1920
20-
If given as a string, the value of d2to1 is assumed to be the relative path
21-
to the setup.cfg file to use. Otherwise, if it evaluates to true, it
22-
simply assumes that d2to1 should be used, and the default 'setup.cfg' is
23-
used.
21+
If given as a string, the value of setup_cfg is assumed to be the relative
22+
path to the setup.cfg file to use. Otherwise, if it evaluates to true, it
23+
simply assumes that setup.cfg should be used, and the default 'setup.cfg'
24+
file is used.
2425
2526
This works by reading the setup.cfg file, parsing out the supported
2627
metadata and command options, and using them to rebuild the
File renamed without changes.

d2to1/tests/__init__.py renamed to setup/cfg/tests/__init__.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44
import subprocess
55
import sys
66
import tempfile
7+
import textwrap
78

89
import pkg_resources
910

1011
from .util import rmtree, open_config
1112

1213

13-
D2TO1_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
14-
os.pardir, os.pardir))
14+
SETUP_CFG_DIR = os.path.abspath(
15+
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir))
1516

1617

17-
def fake_d2to1_dist():
18-
# Fake a d2to1 distribution from the d2to1 package that these tests reside
19-
# in and make sure it's active on the path with the appropriate entry
20-
# points installed
18+
def fake_setup_cfg_dist():
19+
# Fake a setup.cfg distribution from the setup.cfg package that these tests
20+
# reside in and make sure it's active on the path with the appropriate
21+
# entry points installed
2122

2223
class _FakeProvider(pkg_resources.EmptyProvider):
2324
"""A fake metadata provider that does almost nothing except to return
@@ -29,24 +30,28 @@ def has_metadata(self, name):
2930

3031
def get_metadata(self, name):
3132
if name == 'entry_points.txt':
32-
return '[distutils.setup_keywords]\nd2to1 = d2to1.core:d2to1\n'
33+
return textwrap.dedent("""\
34+
[distutils.setup_keywords]
35+
setup_cfg = setup.cfg.core:setup_cfg
36+
""")
3337
else:
3438
return ''
3539

3640

37-
sys.path.insert(0, D2TO1_DIR)
38-
if 'd2to1' in sys.modules:
39-
del sys.modules['d2to1']
40-
if 'd2to1' in pkg_resources.working_set.by_key:
41-
del pkg_resources.working_set.by_key['d2to1']
42-
dist = pkg_resources.Distribution(location=D2TO1_DIR, project_name='d2to1',
41+
sys.path.insert(0, SETUP_CFG_DIR)
42+
if 'setup.cfg' in sys.modules:
43+
del sys.modules['setup.cfg']
44+
if 'setup.cfg' in pkg_resources.working_set.by_key:
45+
del pkg_resources.working_set.by_key['setup.cfg']
46+
dist = pkg_resources.Distribution(location=SETUP_CFG_DIR,
47+
project_name='setup.cfg',
4348
metadata=_FakeProvider())
4449
pkg_resources.working_set.add(dist)
4550

4651

4752
class D2to1TestCase(object):
4853
def setup(self):
49-
self.temp_dir = tempfile.mkdtemp(prefix='d2to1-test-')
54+
self.temp_dir = tempfile.mkdtemp(prefix='setup.cfg-test-')
5055
self.package_dir = os.path.join(self.temp_dir, 'testpackage')
5156
shutil.copytree(os.path.join(os.path.dirname(__file__), 'testpackage'),
5257
self.package_dir)
@@ -55,20 +60,21 @@ def setup(self):
5560

5661
def teardown(self):
5762
os.chdir(self.oldcwd)
58-
# Remove d2to1.testpackage from sys.modules so that it can be freshly
59-
# re-imported by the next test
63+
# Remove setup.cfg.testpackage from sys.modules so that it can be
64+
# freshly re-imported by the next test
6065
for k in list(sys.modules):
61-
if (k == 'd2to1_testpackage' or
62-
k.startswith('d2to1_testpackage.')):
66+
if (k == 'setup_cfg_testpackage' or
67+
k.startswith('setup_cfg_testpackage.')):
6368
del sys.modules[k]
6469
rmtree(self.temp_dir)
6570

6671
def run_setup(self, *args):
6772
cmd = ('-c',
6873
'import sys;sys.path.insert(0, %r);'
69-
'from d2to1.tests import fake_d2to1_dist;'
70-
'from d2to1.extern.six import exec_;'
71-
'fake_d2to1_dist();exec_(open("setup.py").read())' % D2TO1_DIR)
74+
'from setup.cfg.tests import fake_setup_cfg_dist;'
75+
'from setup.cfg.extern.six import exec_;'
76+
'fake_setup_cfg_dist();exec_(open("setup.py").read())' %
77+
SETUP_CFG_DIR)
7278
return self._run_cmd(sys.executable, cmd + args)
7379

7480
def run_svn(self, *args):
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)