4 from distutils
.core
import setup
6 from stgit
.version
import version
, git_min_ver
, python_min_ver
8 def __version_to_list(version
):
9 """Convert a version string to a list of numbers or strings
12 for p
in version
.split('.'):
20 def __check_min_version(min_ver
, ver
):
21 """Check whether ver is greater or equal to min_ver
23 min_ver_list
= __version_to_list(min_ver
)
24 ver_list
= __version_to_list(ver
)
25 return min_ver_list
<= ver_list
27 def __check_python_version():
28 """Check the minimum Python version
30 pyver
= '.'.join(map(lambda x
: str(x
), sys
.version_info
))
31 if not __check_min_version(python_min_ver
, pyver
):
32 print >> sys
.stderr
, 'Python version %s or newer required. Found %s' \
33 %
(python_min_ver
, pyver
)
36 def __check_git_version():
37 """Check the minimum GIT version
39 from stgit
.run
import Run
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()
51 # ensure readable template files
52 old_mask
= os
.umask(0022)
57 author
= 'Catalin Marinas',
58 author_email
= 'catalin.marinas@gmail.com',
59 url
= 'http://www.procode.org/stgit/',
60 description
= 'Stacked GIT',
61 long_description
= 'Push/pop utility on top of GIT',
63 packages
= ['stgit', 'stgit.commands'],
64 data_files
= [('share/stgit/templates', glob
.glob('templates/*.tmpl')),
65 ('share/stgit/examples', glob
.glob('examples/*.tmpl')),
66 ('share/stgit/examples', ['examples/gitconfig']),
67 ('share/stgit/contrib', ['contrib/diffcol.sh',
68 'contrib/stgbashprompt.sh',
69 'contrib/stgit-completion.bash']),
70 ('share/doc/stgit', glob
.glob('doc/*.txt'))]
73 # restore the old mask