| author | ymh <ymh.work@gmail.com> |
| Tue, 03 May 2011 17:20:47 +0200 | |
| changeset 84 | 91a4dafd5904 |
| parent 63 | 93325a5d61f0 |
| child 167 | fe00e7302efe |
| permissions | -rw-r--r-- |
| 0 | 1 |
import os |
|
48
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
2 |
|
|
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
3 |
from distribute_setup import use_setuptools |
|
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
4 |
use_setuptools() |
|
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
5 |
|
|
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
6 |
from setuptools import setup |
| 0 | 7 |
|
8 |
ROOT_DIR = os.path.dirname(__file__) |
|
| 3 | 9 |
SOURCE_DIR = os.path.join(ROOT_DIR, 'ldt') |
| 0 | 10 |
|
|
84
91a4dafd5904
improve setup and debug lucene calls
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
11 |
version_variables = {} |
|
91a4dafd5904
improve setup and debug lucene calls
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
12 |
try: |
|
91a4dafd5904
improve setup and debug lucene calls
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
13 |
execfile(os.path.join(SOURCE_DIR, "__init__.py"), version_variables) |
|
91a4dafd5904
improve setup and debug lucene calls
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
14 |
except: |
|
91a4dafd5904
improve setup and debug lucene calls
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
15 |
pass |
|
91a4dafd5904
improve setup and debug lucene calls
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
16 |
|
|
91a4dafd5904
improve setup and debug lucene calls
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
17 |
version = version_variables['__version__'] |
| 0 | 18 |
|
| 3 | 19 |
def fullsplit(path, result=None): |
20 |
""" |
|
21 |
Split a pathname into components (the opposite of os.path.join) in a |
|
22 |
platform-neutral way. |
|
23 |
""" |
|
24 |
if result is None: |
|
| 30 | 25 |
result = [] |
| 3 | 26 |
head, tail = os.path.split(path) |
27 |
if head == '': |
|
28 |
return [tail] + result |
|
29 |
if head == path: |
|
30 |
return result |
|
31 |
return fullsplit(head, [tail] + result) |
|
32 |
||
| 30 | 33 |
packages, data_files, path_processed = [], {}, [] |
34 |
||
35 |
#TODO : uses find_packages form setuptools and teh mercurial extension |
|
| 2 | 36 |
|
| 63 | 37 |
for dirpath, dirnames, filenames in os.walk(SOURCE_DIR, True): |
| 2 | 38 |
# Ignore dirnames that start with '.' |
| 30 | 39 |
if dirpath in path_processed: |
40 |
continue |
|
41 |
path_processed.append(dirpath) |
|
| 2 | 42 |
for i, dirname in enumerate(dirnames): |
43 |
if dirname.startswith('.'): del dirnames[i] |
|
44 |
if '__init__.py' in filenames: |
|
45 |
packages.append('.'.join(fullsplit(dirpath))) |
|
| 30 | 46 |
else: |
47 |
new_data_files = [] |
|
48 |
base_path_list = fullsplit(dirpath)[:-1] |
|
49 |
base_path = "/".join(base_path_list) + "/" |
|
50 |
key = '.'.join(base_path_list) |
|
51 |
for ldirpath, ldirnames, lfilenames in os.walk(dirpath): |
|
52 |
path_processed.append(ldirpath) |
|
53 |
new_data_files.extend([os.path.join(ldirpath[len(base_path):], f) for f in lfilenames]) |
|
| 63 | 54 |
data_files.setdefault(key, []).extend(new_data_files) |
| 30 | 55 |
|
|
48
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
56 |
#write MANIFEST.in |
|
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
57 |
|
|
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
58 |
m = open("MANIFEST.in", "w") |
|
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
59 |
|
|
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
60 |
m.write("exclude MANIFEST.in\n") |
| 63 | 61 |
for key, file_list in data_files.iteritems(): |
|
48
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
62 |
for filename in file_list: |
| 63 | 63 |
m.write("include %s/%s\n" % (key.replace(".", "/"), filename)) |
|
48
ef3a8cfef2bc
correct setup.py to integrate templsters
ymh <ymh.work@gmail.com>
parents:
30
diff
changeset
|
64 |
m.close() |
| 2 | 65 |
|
| 0 | 66 |
setup( |
| 30 | 67 |
name='ldt', |
|
13
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
68 |
version=version, |
|
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
69 |
author='Yves-Marie Haussonne (IRI)', |
|
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
70 |
author_email='contact@iri.centrepompidou.fr', |
| 63 | 71 |
packages=packages, |
72 |
package_data=data_files, |
|
|
13
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
73 |
scripts=[], |
|
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
74 |
url='https://www.iri.centrepompidou.fr/dev/hg/platform', |
|
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
75 |
license='LICENSE.txt', |
|
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
76 |
description='Platform ldt', |
|
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
77 |
long_description=open('README.txt').read(), |
|
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
78 |
zip_safe=False, |
|
97ab7b3191cf
add api to update project, uses psiton
ymh <ymh.work@gmail.com>
parents:
3
diff
changeset
|
79 |
classifiers=['Development Status :: 5 - Production/Stable', |
| 0 | 80 |
'Environment :: Web Environment', |
81 |
'Framework :: Django', |
|
82 |
'Intended Audience :: Developers', |
|
83 |
'License :: Ceccil-C', |
|
84 |
'Operating System :: OS Independent', |
|
85 |
'Programming Language :: Python', |
|
86 |
'Topic :: Utilities'], |
|
87 |
) |