-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
97 lines (86 loc) · 3.11 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python
CLASSIFIERS = """\
Development Status :: 3 - Alpha
Intended Audience :: Science/Research
License :: OSI Approved
Programming Language :: Python
Topic :: Scientific/Engineering
Topic :: Software Development
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Operating System :: Unix
Operating System :: MacOS
"""
MAJOR = 0
MINOR = 4
MICRO = 1
ISRELEASED = not True
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
import os
if os.path.exists('MANIFEST'): os.remove('MANIFEST')
def write_version_py(filename='libtiff/version.py'):
cnt = """
# THIS FILE IS GENERATED FROM libtiff/setup.py
short_version='%(version)s'
version='%(version)s'
release=%(isrelease)s
if not release:
version += '.dev'
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'__svn_version__.py')
svn_entries_file = os.path.join(os.path.dirname(__file__),'.svn',
'entries')
if os.path.isfile(svn_version_file):
import imp
svn = imp.load_module('libtiff.__svn_version__',
open(svn_version_file),
svn_version_file,
('.py','U',1))
version += svn.version
elif os.path.isfile(svn_entries_file):
import subprocess
try:
svn_version = subprocess.Popen(["svnversion", os.path.dirname (__file__)], stdout=subprocess.PIPE).communicate()[0]
except:
pass
else:
version += svn_version.strip()
print version
"""
a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION, 'isrelease': str(ISRELEASED)})
finally:
a.close()
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration(None,parent_package,top_path)
config.add_subpackage('libtiff')
config.get_version('libtiff/version.py')
config.add_data_files(('libtiff','LICENSE'))
return config
if __name__=='__main__':
from numpy.distutils.core import setup
# Rewrite the version file everytime
if os.path.exists('libtiff/version.py'): os.remove('libtiff/version.py')
write_version_py()
setup(name='libtiff',
#version='0.3-svn',
author = 'Pearu Peterson',
author_email = '[email protected]',
license = 'http://pylibtiff.googlecode.com/svn/trunk/LICENSE',
url = 'http://pylibtiff.googlecode.com',
#download_url = 'http://code.google.com/p/pylibtiff/downloads/',
classifiers=filter(None, CLASSIFIERS.split('\n')),
description = 'PyLibTiff: a Python tiff library.',
long_description = '''\
PyLibTiff? is a Python package that provides the following modules:
libtiff - a wrapper of C libtiff library using ctypes.
tiff - a numpy.memmap view of tiff files.
''',
platforms = ["All"],
#packages = ['libtiff'],
#package_dir = {'libtiff': 'libtiff'},
configuration = configuration,
)