annotate setup.py @ 135:f6b6e16531f8

Added tag 1.4 for changeset 1b47146a4a2c
author Matt Mackall <mpm@selenic.com>
date Wed, 01 Oct 2014 15:03:32 -0500
parents 1b47146a4a2c
children 91329df47df5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
80
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
1 import os, time
66
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2 from distutils.core import setup
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3
80
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
4 # query Mercurial for version number
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
5 version = 'unknown'
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
6 if os.path.isdir('.hg'):
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
7 cmd = "hg id -i -t"
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
8 l = os.popen(cmd).read().split()
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
9 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
10 l.pop()
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
11 if len(l) > 1: # tag found
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
12 version = l[-1]
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
13 if l[0].endswith('+'): # propagate the dirty status to the tag
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
14 version += '+'
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
15 elif len(l) == 1: # no tag found
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
16 cmd = 'hg parents --template "{latesttag}+{latesttagdistance}-"'
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
17 version = os.popen(cmd).read() + l[0]
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
18 if version.endswith('+'):
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
19 version += time.strftime('%Y%m%d')
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
20 elif os.path.exists('.hg_archival.txt'):
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
21 kw = dict([[t.strip() for t in l.split(':', 1)]
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
22 for l in open('.hg_archival.txt')])
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
23 if 'tag' in kw:
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
24 version = kw['tag']
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
25 elif 'latesttag' in kw:
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
26 version = '%(latesttag)s+%(latesttagdistance)s-%(node).12s' % kw
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
27 else:
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
28 version = kw.get('node', '')[:12]
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
29
66
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
30 setup(
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
31 name='python-hglib',
80
009e7858a93b setup: add version number lookup
Matt Mackall <mpm@selenic.com>
parents: 66
diff changeset
32 version=version,
66
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
33 author='Idan Kamara',
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
34 author_email='idankk86@gmail.com',
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
35 url='http://selenic.com/repo/python-hglib',
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
36 description='Mercurial Python library',
134
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 80
diff changeset
37 long_description=open(os.path.join(os.path.dirname(__file__),
1b47146a4a2c style: fix long lines
Matt Mackall <mpm@selenic.com>
parents: 80
diff changeset
38 'README')).read(),
66
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
39 license='MIT',
358fd5c84270 add a setup.py
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
40 packages=['hglib'])