1 import os |
1 import os |
2 from distutils.core import setup |
2 from distutils.core import setup |
3 from distutils.command.install_data import install_data |
3 from distutils.command.install_data import install_data |
4 from distutils.command.install import INSTALL_SCHEMES |
4 from distutils.command.install import INSTALL_SCHEMES |
5 import sys |
5 import sys |
6 |
|
7 |
6 |
8 class osx_install_data(install_data): |
7 class osx_install_data(install_data): |
9 # On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../ |
8 # On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../ |
10 # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix |
9 # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix |
11 # for this in distutils.command.install_data#306. It fixes install_lib but not |
10 # for this in distutils.command.install_data#306. It fixes install_lib but not |
58 for source_dir in source_dirs: |
57 for source_dir in source_dirs: |
59 for dirpath, dirnames, filenames in os.walk(source_dir): |
58 for dirpath, dirnames, filenames in os.walk(source_dir): |
60 # Ignore dirnames that start with '.' |
59 # Ignore dirnames that start with '.' |
61 for i, dirname in enumerate(dirnames): |
60 for i, dirname in enumerate(dirnames): |
62 if dirname.startswith('.'): del dirnames[i] |
61 if dirname.startswith('.'): del dirnames[i] |
|
62 if dirname.startswith('__pycache__'): del dirnames[i] |
63 if '__init__.py' in filenames: |
63 if '__init__.py' in filenames: |
64 packages.append('.'.join(fullsplit(dirpath))) |
64 packages.append('.'.join(fullsplit(dirpath))) |
65 elif filenames: |
65 elif filenames: |
66 data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]]) |
66 data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]]) |
67 |
|
68 |
67 |
69 # Tell distutils to put the data_files in platform-specific installation |
68 # Tell distutils to put the data_files in platform-specific installation |
70 # locations. See here for an explanation: |
69 # locations. See here for an explanation: |
71 # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb |
70 # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb |
72 for scheme in INSTALL_SCHEMES.values(): |
71 for scheme in INSTALL_SCHEMES.values(): |