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