Skip to content

Commit 63781f2

Browse files
committed
Call setup() directly in setup.py
The __run_setup() wrapper is unnecessary and calling setup() directly is the conventional approach. Signed-off-by: Peter Grayson <[email protected]>
1 parent e9bf305 commit 63781f2

File tree

1 file changed

+45
-43
lines changed

1 file changed

+45
-43
lines changed

setup.py

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import (absolute_import, division, print_function,
44
unicode_literals)
55
from distutils.core import setup
6-
import glob
6+
from glob import glob
77
import os
88
import sys
99

@@ -23,13 +23,15 @@ def __version_to_list(version):
2323
ver_list.append(n)
2424
return ver_list
2525

26+
2627
def __check_min_version(min_ver, ver):
2728
"""Check whether ver is greater or equal to min_ver
2829
"""
2930
min_ver_list = __version_to_list(min_ver)
3031
ver_list = __version_to_list(ver)
3132
return min_ver_list <= ver_list
3233

34+
3335
def __check_python_version():
3436
"""Check the minimum Python version
3537
"""
@@ -39,6 +41,7 @@ def __check_python_version():
3941
% (version.python_min_ver, pyver), file=sys.stderr)
4042
sys.exit(1)
4143

44+
4245
def __check_git_version():
4346
"""Check the minimum GIT version
4447
"""
@@ -49,46 +52,6 @@ def __check_git_version():
4952
% (version.git_min_ver, gitver), file=sys.stderr)
5053
sys.exit(1)
5154

52-
def __run_setup():
53-
setup(name = 'stgit',
54-
version = version.version,
55-
license = 'GPLv2',
56-
author = 'Catalin Marinas',
57-
author_email = '[email protected]',
58-
url = 'http://www.procode.org/stgit/',
59-
download_url = 'http://repo.or.cz/stgit.git',
60-
description = 'Stacked GIT',
61-
long_description = 'Push/pop utility on top of GIT',
62-
scripts = ['stg'],
63-
packages = list(map(str, ['stgit', 'stgit.commands', 'stgit.lib'])),
64-
data_files = [
65-
('share/stgit/templates', glob.glob('templates/*.tmpl')),
66-
('share/stgit/examples', glob.glob('examples/*.tmpl')),
67-
('share/stgit/examples', ['examples/gitconfig']),
68-
('share/stgit/contrib', ['contrib/stgbashprompt.sh']),
69-
('share/stgit/completion', ['stgit-completion.bash'])
70-
],
71-
classifiers = [
72-
'Development Status :: 5 - Production/Stable',
73-
'Environment :: Console',
74-
'Intended Audience :: Developers',
75-
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)'
76-
'Natural Language :: English',
77-
'Operating System :: OS Independent',
78-
'Programming Language :: Python',
79-
'Programming Language :: Python :: 2',
80-
'Programming Language :: Python :: 2.6',
81-
'Programming Language :: Python :: 2.7',
82-
'Programming Language :: Python :: 3',
83-
'Programming Language :: Python :: 3.3',
84-
'Programming Language :: Python :: 3.4',
85-
'Programming Language :: Python :: 3.5',
86-
'Programming Language :: Python :: 3.6',
87-
'Programming Language :: Python :: Implementation :: CPython',
88-
'Programming Language :: Python :: Implementation :: PyPy',
89-
'Topic :: Software Development :: Version Control',
90-
])
91-
9255

9356
# Check the minimum versions required
9457
__check_python_version()
@@ -101,13 +64,52 @@ def __run_setup():
10164

10265
# generate the python command list
10366
with open('stgit/commands/cmdlist.py', 'w') as f:
104-
commands.py_commands(commands.get_commands(allow_cached = False), f)
67+
commands.py_commands(commands.get_commands(allow_cached=False), f)
10568

10669
# generate the bash completion script
10770
with open('stgit-completion.bash', 'w') as f:
10871
completion.write_completion(f)
10972

110-
__run_setup()
73+
setup(
74+
name='stgit',
75+
version=version.version,
76+
license='GPLv2',
77+
author='Catalin Marinas',
78+
author_email='[email protected]',
79+
url='http://www.procode.org/stgit/',
80+
download_url='http://repo.or.cz/stgit.git',
81+
description='Stacked GIT',
82+
long_description='Push/pop utility on top of GIT',
83+
scripts=['stg'],
84+
packages=list(map(str, ['stgit', 'stgit.commands', 'stgit.lib'])),
85+
data_files=[
86+
('share/stgit/templates', glob('templates/*.tmpl')),
87+
('share/stgit/examples', glob('examples/*.tmpl')),
88+
('share/stgit/examples', ['examples/gitconfig']),
89+
('share/stgit/contrib', ['contrib/stgbashprompt.sh']),
90+
('share/stgit/completion', ['stgit-completion.bash']),
91+
],
92+
classifiers=[
93+
'Development Status :: 5 - Production/Stable',
94+
'Environment :: Console',
95+
'Intended Audience :: Developers',
96+
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)'
97+
'Natural Language :: English',
98+
'Operating System :: OS Independent',
99+
'Programming Language :: Python',
100+
'Programming Language :: Python :: 2',
101+
'Programming Language :: Python :: 2.6',
102+
'Programming Language :: Python :: 2.7',
103+
'Programming Language :: Python :: 3',
104+
'Programming Language :: Python :: 3.3',
105+
'Programming Language :: Python :: 3.4',
106+
'Programming Language :: Python :: 3.5',
107+
'Programming Language :: Python :: 3.6',
108+
'Programming Language :: Python :: Implementation :: CPython',
109+
'Programming Language :: Python :: Implementation :: PyPy',
110+
'Topic :: Software Development :: Version Control',
111+
],
112+
)
111113

112114
# restore the old mask
113115
os.umask(old_mask)

0 commit comments

Comments
 (0)