1 from distutils
.core
import setup
2 from distutils
.command
.install_data
import install_data
3 from distutils
.command
.install
import INSTALL_SCHEMES
7 class osx_install_data(install_data
):
8 # On MacOS the plattform specific lib dir is /System/Library/Framework/Python/.../
9 # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Aplle specific fix
10 # for this in distutils.command.install_data#306 It fixes install_lib but not
11 # install_data, which is why we roll our own install_data class.
13 def finalize_options (self
):
14 # By the time finalize_options is called install.install_lib is set to the
15 # fixed directory. so we set the installdir for to install_lib, the
16 # install_data class uses ('install_data', 'install_dir') instead.
17 self
.set_undefined_options('install', ('install_lib', 'install_dir'))
18 install_data
.finalize_options(self
)
20 if sys
.platform
== "darwin":
21 cmdclasses
= {'install_data': osx_install_data
}
23 cmdclasses
= {'install_data': install_data
}
25 def fullsplit(path
, result
=None):
27 Split a pathname into components (the opposite of os.path.join) in a
32 head
, tail
= os
.path
.split(path
)
34 return [tail
] + result
37 return fullsplit(head
, [tail
] + result
)
39 # Tell distutils to put the data_files in platform-specific installation
40 # locations. See here for an explanation:
41 # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
42 for scheme
in INSTALL_SCHEMES
.values():
43 scheme
['data'] = scheme
['purelib']
45 # Compile the list of packages available, because distutils doesn't have
46 # an easy way to do this.
47 packages
, data_files
= [], []
48 root_dir
= os
.path
.dirname(__file__
)
53 for dirpath
, dirnames
, filenames
in os
.walk(django_dir
):
54 # Ignore dirnames that start with '.'
55 for i
, dirname
in enumerate(dirnames
):
56 if dirname
.startswith('.'): del dirnames
[i
]
57 if '__init__.py' in filenames
:
58 packages
.append('.'.join(fullsplit(dirpath
)))
60 data_files
.append([dirpath
, [os
.path
.join(dirpath
, f
) for f
in filenames
]])
62 # Dynamically calculate the version based on django.VERSION.
63 version_tuple
= __import__('django').VERSION
64 if version_tuple
[2] is not None:
65 version
= "%d.%d_%s" % version_tuple
67 version
= "%d.%d" % version_tuple
[:2]
72 url
= 'http://www.djangoproject.com/',
73 author
= 'Django Software Foundation',
74 author_email
= 'foundation@djangoproject.com',
75 description
= 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
77 cmdclass
= cmdclasses
,
78 data_files
= data_files
,
79 scripts
= ['django/bin/django-admin.py'],