Skip to content
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Commit 0819784

Browse files
committed
Fixing issues with easy_install in setup.py to allow async to be easy_installed. Its a mess, but I didn't expect anything else. Having everything in one directory really is not what they want ...
1 parent 76f15fc commit 0819784

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

setup.py

+56-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,60 @@
11
#!/usr/bin/env python
2-
from distutils.core import setup, Extension
2+
from distutils.core import setup, Extension
3+
from distutils.command.build_py import build_py
4+
5+
import os, sys
6+
7+
# wow, this is a mixed bag ... I am pretty upset about all of this ...
8+
setuptools_build_py_module = None
9+
try:
10+
# don't pull it in if we don't have to
11+
if 'setuptools' in sys.modules:
12+
import setuptools.command.build_py as setuptools_build_py_module
13+
except ImportError:
14+
pass
15+
16+
def get_data_files(self):
17+
"""Can you feel the pain ? So, in python2.5 and python2.4 coming with maya,
18+
the line dealing with the ``plen`` has a bug which causes it to truncate too much.
19+
It is fixed in the system interpreters as they receive patches, and shows how
20+
bad it is if something doesn't have proper unittests.
21+
The code here is a plain copy of the python2.6 version which works for all.
22+
23+
Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
24+
data = []
25+
if not self.packages:
26+
return data
27+
28+
# this one is just for the setup tools ! They don't iniitlialize this variable
29+
# when they should, but do it on demand using this method.Its crazy
30+
if hasattr(self, 'analyze_manifest'):
31+
self.analyze_manifest()
32+
# END handle setuptools ...
33+
34+
for package in self.packages:
35+
# Locate package source directory
36+
src_dir = self.get_package_dir(package)
37+
38+
# Compute package build directory
39+
build_dir = os.path.join(*([self.build_lib] + package.split('.')))
40+
41+
# Length of path to strip from found files
42+
plen = 0
43+
if src_dir:
44+
plen = len(src_dir)+1
45+
46+
# Strip directory from globbed filenames
47+
filenames = [
48+
file[plen:] for file in self.find_data_files(package, src_dir)
49+
]
50+
data.append((package, src_dir, build_dir, filenames))
51+
return data
52+
53+
build_py.get_data_files = get_data_files
54+
if setuptools_build_py_module:
55+
setuptools_build_py_module.build_py._get_data_files = get_data_files
56+
# END apply setuptools patch too
57+
358

459
setup(name = "async",
560
version = "0.6.0",

0 commit comments

Comments
 (0)