10 """ |
10 """ |
11 Split a pathname into components (the opposite of os.path.join) in a |
11 Split a pathname into components (the opposite of os.path.join) in a |
12 platform-neutral way. |
12 platform-neutral way. |
13 """ |
13 """ |
14 if result is None: |
14 if result is None: |
15 result = [] |
15 result = [] |
16 head, tail = os.path.split(path) |
16 head, tail = os.path.split(path) |
17 if head == '': |
17 if head == '': |
18 return [tail] + result |
18 return [tail] + result |
19 if head == path: |
19 if head == path: |
20 return result |
20 return result |
21 return fullsplit(head, [tail] + result) |
21 return fullsplit(head, [tail] + result) |
22 |
22 |
23 packages, data_files = [], [] |
23 packages, data_files, path_processed = [], {}, [] |
24 |
24 |
25 for dirpath, dirnames, filenames in os.walk(SOURCE_DIR): |
25 #TODO : uses find_packages form setuptools and teh mercurial extension |
|
26 |
|
27 for dirpath, dirnames, filenames in os.walk(SOURCE_DIR,True): |
26 # Ignore dirnames that start with '.' |
28 # Ignore dirnames that start with '.' |
|
29 if dirpath in path_processed: |
|
30 continue |
|
31 path_processed.append(dirpath) |
27 for i, dirname in enumerate(dirnames): |
32 for i, dirname in enumerate(dirnames): |
28 if dirname.startswith('.'): del dirnames[i] |
33 if dirname.startswith('.'): del dirnames[i] |
29 if '__init__.py' in filenames: |
34 if '__init__.py' in filenames: |
30 packages.append('.'.join(fullsplit(dirpath))) |
35 packages.append('.'.join(fullsplit(dirpath))) |
31 elif filenames: |
36 else: |
32 data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]]) |
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 |
33 |
46 |
34 setup( |
47 setup( |
35 name='Ldt', |
48 name='ldt', |
36 version=version, |
49 version=version, |
37 author='Yves-Marie Haussonne (IRI)', |
50 author='Yves-Marie Haussonne (IRI)', |
38 author_email='contact@iri.centrepompidou.fr', |
51 author_email='contact@iri.centrepompidou.fr', |
39 packages=packages, |
52 packages = find_packages(), |
40 data_files=data_files, |
53 package_data = data_files, |
41 # package_data = { |
|
42 # '': [ |
|
43 # 'media/*', |
|
44 # 'locale/*/LC_MESSAGES/*', |
|
45 # 'templates/ldt/*.html', |
|
46 # 'templates/admin/*.html', |
|
47 # 'templates/cms/admin/cms/page/*.html', |
|
48 # ] |
|
49 # }, |
|
50 scripts=[], |
54 scripts=[], |
51 url='https://www.iri.centrepompidou.fr/dev/hg/platform', |
55 url='https://www.iri.centrepompidou.fr/dev/hg/platform', |
52 license='LICENSE.txt', |
56 license='LICENSE.txt', |
53 description='Platform ldt', |
57 description='Platform ldt', |
54 long_description=open('README.txt').read(), |
58 long_description=open('README.txt').read(), |