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