Skip to content

Commit c681624

Browse files
committed
0.2.5
- add license to standard attributes for PKG_INFO inlusion - move magic index to attribute of Config
1 parent b760ea9 commit c681624

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

pypackage/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def write_pkg_info(self, egg_info):
134134
class Config(object):
135135
"""Config object. Attributes are passed as kwargs."""
136136

137+
_STD_TO_EXTD_INDEX = 18
137138
_KEYS = OrderedDict([ # all available configuration keys: value type
138139
("name", str),
139140
("version", str),
@@ -143,6 +144,7 @@ class Config(object):
143144
("author_email", str),
144145
("maintainer", str),
145146
("maintainer_email", str),
147+
("license", str),
146148
("url", str),
147149
("download_url", str),
148150
("packages", list),

pypackage/configure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def standard_attributes(config, options):
136136
config: config object to use
137137
"""
138138

139-
all_in_this_cat = list(config._KEYS.keys())[:17]
139+
all_in_this_cat = list(config._KEYS.keys())[:config._STD_TO_EXTD_INDEX]
140140

141141
if options.re_config:
142142
return all_in_this_cat
@@ -170,7 +170,7 @@ def feature_attributes(config, options):
170170
def extended_attributes(config, options):
171171
"""Builds a list of unconfigured extended attributes in config."""
172172

173-
all_in_this_cat = list(config._KEYS.keys())[17:]
173+
all_in_this_cat = list(config._KEYS.keys())[config._STD_TO_EXTD_INDEX:]
174174

175175
if options.re_config:
176176
return all_in_this_cat

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def long_description():
3232

3333
setup(
3434
name="pypackage",
35-
version="0.2.4",
35+
version="0.2.5",
3636
author="Adam Talsma",
3737
author_email="[email protected]",
3838
url="http://ccpgames.github.io/pypackage",

test/test_configure.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def test_standard_attributes(reset_sys_argv, move_home_pypackage):
160160
"""Ensure the standard attribute set."""
161161

162162
conf = Config()
163-
expected_attrs = list(conf._KEYS.keys())[:17]
163+
expected_attrs = list(conf._KEYS.keys())[:conf._STD_TO_EXTD_INDEX]
164164
conf.name = "foobar"
165165
conf.classifiers = ["fake classifier"]
166166
expected_attrs.remove("name")
@@ -176,7 +176,7 @@ def test_standard_attributes__re_config(reset_sys_argv):
176176
conf.name = "something"
177177
sys.argv = ["py-build", "-r"]
178178
attrs = configure.standard_attributes(conf, get_options())
179-
expected = list(conf._KEYS.keys())[:17]
179+
expected = list(conf._KEYS.keys())[:conf._STD_TO_EXTD_INDEX]
180180
assert attrs == expected
181181

182182

@@ -213,10 +213,10 @@ def test_feature_attributes__re_config(reset_sys_argv):
213213

214214

215215
def test_extended_attributes(reset_sys_argv, move_home_pypackage):
216-
"""Extended attributes should return any unset keys past 17."""
216+
"""Extended attributes should return unset keys past _STD_TO_EXTD_INDEX."""
217217

218218
conf = Config()
219-
expected = list(conf._KEYS.keys())[17:]
219+
expected = list(conf._KEYS.keys())[conf._STD_TO_EXTD_INDEX:]
220220
conf.use_2to3 = True
221221
expected.remove("use_2to3")
222222
attrs = configure.extended_attributes(conf, get_options())
@@ -230,7 +230,7 @@ def test_extended_attributes__re_config(reset_sys_argv):
230230
conf.use_2to3 = True
231231
sys.argv = ["py-build", "-r"]
232232
attrs = configure.extended_attributes(conf, get_options())
233-
expected = list(conf._KEYS.keys())[17:]
233+
expected = list(conf._KEYS.keys())[conf._STD_TO_EXTD_INDEX:]
234234
assert attrs == expected
235235

236236

0 commit comments

Comments
 (0)