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

Commit f534e6e

Browse files
committed
Added fixes to setup.py to allow easy_installation
1 parent ac7d475 commit f534e6e

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

ext/async

Submodule async updated from 76f15fc to 0819784

setup.py

+56-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,60 @@
11
#!/usr/bin/env python
22
from distutils.core import setup, Extension
3-
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+
458
setup(name = "gitdb",
559
version = "0.5.0",
660
description = "Git Object Database",
@@ -14,5 +68,6 @@
1468
ext_modules=[Extension('gitdb._fun', ['_fun.c'])],
1569
license = "BSD License",
1670
requires=('async (>=0.6.0)',),
71+
install_requires='async >= 0.6.0',
1772
long_description = """GitDB is a pure-Python git object database"""
1873
)

0 commit comments

Comments
 (0)