14 # By the time finalize_options is called, install.install_lib is set to the |
15 # By the time finalize_options is called, install.install_lib is set to the |
15 # fixed directory, so we set the installdir to install_lib. The |
16 # fixed directory, so we set the installdir to install_lib. The |
16 # install_data class uses ('install_data', 'install_dir') instead. |
17 # install_data class uses ('install_data', 'install_dir') instead. |
17 self.set_undefined_options('install', ('install_lib', 'install_dir')) |
18 self.set_undefined_options('install', ('install_lib', 'install_dir')) |
18 install_data.finalize_options(self) |
19 install_data.finalize_options(self) |
19 |
|
20 if sys.platform == "darwin": |
|
21 cmdclasses = {'install_data': osx_install_data} |
|
22 else: |
|
23 cmdclasses = {'install_data': install_data} |
|
24 |
|
25 |
|
26 root_dir = os.path.dirname(__file__) |
|
27 if root_dir != '': |
|
28 os.chdir(root_dir) |
|
29 source_dir = 'ldt' |
|
30 |
|
31 version_variables = {} |
|
32 try: |
|
33 execfile(os.path.join(source_dir, "__init__.py"), version_variables) |
|
34 except: |
|
35 pass |
|
36 |
|
37 version = version_variables['__version__'] |
|
38 |
20 |
39 def fullsplit(path, result=None): |
21 def fullsplit(path, result=None): |
40 """ |
22 """ |
41 Split a pathname into components (the opposite of os.path.join) in a |
23 Split a pathname into components (the opposite of os.path.join) in a |
42 platform-neutral way. |
24 platform-neutral way. |
48 return [tail] + result |
30 return [tail] + result |
49 if head == path: |
31 if head == path: |
50 return result |
32 return result |
51 return fullsplit(head, [tail] + result) |
33 return fullsplit(head, [tail] + result) |
52 |
34 |
53 packages, data_files = [], [] |
35 |
|
36 def launch_setup(script_name, script_args): |
|
37 if sys.platform == "darwin": |
|
38 cmdclasses = {'install_data': osx_install_data} |
|
39 else: |
|
40 cmdclasses = {'install_data': install_data} |
|
41 |
|
42 |
|
43 root_dir = os.path.dirname(__file__) |
|
44 if root_dir != '': |
|
45 os.chdir(root_dir) |
|
46 source_dir = 'ldt' |
|
47 |
|
48 version_variables = {} |
|
49 try: |
|
50 execfile(os.path.join(source_dir, "__init__.py"), version_variables) |
|
51 except: |
|
52 pass |
|
53 |
|
54 version = version_variables['__version__'] |
|
55 |
|
56 packages, data_files = [], [] |
|
57 |
|
58 |
|
59 for dirpath, dirnames, filenames in os.walk(source_dir): |
|
60 # Ignore dirnames that start with '.' |
|
61 for i, dirname in enumerate(dirnames): |
|
62 if dirname.startswith('.'): del dirnames[i] |
|
63 if '__init__.py' in filenames: |
|
64 packages.append('.'.join(fullsplit(dirpath))) |
|
65 elif filenames: |
|
66 data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]]) |
|
67 |
|
68 |
|
69 # Tell distutils to put the data_files in platform-specific installation |
|
70 # locations. See here for an explanation: |
|
71 # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb |
|
72 for scheme in INSTALL_SCHEMES.values(): |
|
73 scheme['data'] = scheme['purelib'] |
|
74 |
|
75 # Small hack for working with bdist_wininst. |
|
76 # See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html |
|
77 if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst': |
|
78 for file_info in data_files: |
|
79 file_info[0] = '\\PURELIB\\%s' % file_info[0] |
|
80 |
|
81 #write MANIFEST.in |
|
82 |
|
83 with open("MANIFEST.in", "w") as m: |
|
84 m.write("include CHANGES\n") |
|
85 m.write("include LICENSE\n") |
|
86 m.write("include README\n") |
|
87 m.write("include MANIFEST.in\n") |
|
88 for entry in data_files: |
|
89 file_list = entry[1] |
|
90 for filename in file_list: |
|
91 m.write("include %s\n" % (filename)) |
|
92 |
|
93 setup( |
|
94 script_name = script_name, |
|
95 script_args = script_args, |
|
96 name='ldt', |
|
97 version=version, |
|
98 author='IRI', |
|
99 author_email='contact@iri.centrepompidou.fr', |
|
100 packages=packages, |
|
101 data_files=data_files, |
|
102 cmdclass = cmdclasses, |
|
103 scripts=[], |
|
104 url='http://www.iri.centrepompidou.fr/dev/hg/platform', |
|
105 license='LICENSE.txt', |
|
106 description='Platform ldt', |
|
107 long_description=open('README').read(), |
|
108 classifiers=['Development Status :: 5 - Production/Stable', |
|
109 'Environment :: Web Environment', |
|
110 'Framework :: Django', |
|
111 'Intended Audience :: Developers', |
|
112 'License :: Ceccil-C', |
|
113 'Operating System :: OS Independent', |
|
114 'Programming Language :: Python', |
|
115 'Topic :: Utilities', |
|
116 ], |
|
117 ) |
54 |
118 |
55 |
119 |
56 for dirpath, dirnames, filenames in os.walk(source_dir): |
120 if __name__ == "__main__": |
57 # Ignore dirnames that start with '.' |
121 |
58 for i, dirname in enumerate(dirnames): |
122 script_name = os.path.basename(sys.argv[0]) |
59 if dirname.startswith('.'): del dirnames[i] |
123 script_args = sys.argv[1:] |
60 if '__init__.py' in filenames: |
124 |
61 packages.append('.'.join(fullsplit(dirpath))) |
125 launch_setup(script_name, script_args) |
62 elif filenames: |
|
63 data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]]) |
|
64 |
|
65 |
|
66 # Tell distutils to put the data_files in platform-specific installation |
|
67 # locations. See here for an explanation: |
|
68 # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb |
|
69 for scheme in INSTALL_SCHEMES.values(): |
|
70 scheme['data'] = scheme['purelib'] |
|
71 |
|
72 # Small hack for working with bdist_wininst. |
|
73 # See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html |
|
74 if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst': |
|
75 for file_info in data_files: |
|
76 file_info[0] = '\\PURELIB\\%s' % file_info[0] |
|
77 |
|
78 #write MANIFEST.in |
|
79 |
|
80 with open("MANIFEST.in", "w") as m: |
|
81 m.write("include CHANGES\n") |
|
82 m.write("include LICENSE\n") |
|
83 m.write("include README\n") |
|
84 m.write("include MANIFEST.in\n") |
|
85 for entry in data_files: |
|
86 file_list = entry[1] |
|
87 for filename in file_list: |
|
88 m.write("include %s\n" % (filename)) |
|
89 |
|
90 |
|
91 setup( |
|
92 name='ldt', |
|
93 version=version, |
|
94 author='IRI', |
|
95 author_email='contact@iri.centrepompidou.fr', |
|
96 packages=packages, |
|
97 data_files=data_files, |
|
98 cmdclass = cmdclasses, |
|
99 scripts=[], |
|
100 url='http://www.iri.centrepompidou.fr/dev/hg/platform', |
|
101 license='LICENSE.txt', |
|
102 description='Platform ldt', |
|
103 long_description=open('README').read(), |
|
104 classifiers=['Development Status :: 5 - Production/Stable', |
|
105 'Environment :: Web Environment', |
|
106 'Framework :: Django', |
|
107 'Intended Audience :: Developers', |
|
108 'License :: Ceccil-C', |
|
109 'Operating System :: OS Independent', |
|
110 'Programming Language :: Python', |
|
111 'Topic :: Utilities', |
|
112 ], |
|
113 ) |
|