4 from distutils
.core
import setup
6 from stgit
.version
import version
, git_min_ver
, python_min_ver
7 from stgit
.run
import Run
9 def __version_to_list(version
):
10 """Convert a version string to a list of numbers or strings
13 for p
in version
.split('.'):
21 def __check_min_version(min_ver
, ver
):
22 """Check whether ver is greater or equal to min_ver
24 min_ver_list
= __version_to_list(min_ver
)
25 ver_list
= __version_to_list(ver
)
26 return min_ver_list
<= ver_list
28 def __check_python_version():
29 """Check the minimum Python version
31 pyver
= '.'.join(str(n
) for n
in sys
.version_info
)
32 if not __check_min_version(python_min_ver
, pyver
):
33 print >> sys
.stderr
, 'Python version %s or newer required. Found %s' \
34 % (python_min_ver
, pyver
)
37 def __check_git_version():
38 """Check the minimum GIT version
40 gitver
= Run('git', '--version').output_one_line().split()[2]
41 if not __check_min_version(git_min_ver
, gitver
):
42 print >> sys
.stderr
, 'GIT version %s or newer required. Found %s' \
43 % (git_min_ver
, gitver
)
46 # Check the minimum versions required
47 if sys
.argv
[1] in ['install', 'build']:
48 __check_python_version()
54 author
= 'Catalin Marinas',
55 author_email
= 'catalin.marinas@gmail.com',
56 url
= 'http://www.procode.org/stgit/',
57 description
= 'Stacked GIT',
58 long_description
= 'Push/pop utility on top of GIT',
60 packages
= ['stgit', 'stgit.commands'],
61 data_files
= [('share/stgit/templates', glob
.glob('templates/*.tmpl')),
62 ('share/stgit/examples', glob
.glob('examples/*.tmpl')),
63 ('share/stgit/examples', ['examples/gitconfig']),
64 ('share/stgit/contrib', ['contrib/diffcol.sh',
65 'contrib/stgbashprompt.sh',
66 'contrib/stgit-completion.bash']),
67 ('share/doc/stgit', glob
.glob('doc/*.txt'))]