-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path__init__.py
34 lines (25 loc) · 952 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from os.path import abspath, curdir
from sys import path
def extension(buildout):
def setup(name, *args, **kw):
buildout['buildout'].setdefault('package-name', name)
# monkey-patch `setuptools.setup` with the above...
import setuptools
original = setuptools.setup
setuptools.setup = setup
# now try to import `setup.py` from the current directory, extract
# the package name using the helper above and set `package-name`
# in the buildout configuration...
here = abspath(curdir)
path.insert(0, here)
import setup
# mention `setup` again to make pyflakes happy... :p
setup
# reset `sys.path` and undo the above monkey-patch
path.remove(here)
setuptools.setup = original
# if there's a `setup.py` in the current directory
# we also want to develop this egg...
# print buildout['buildout']
buildout['buildout'].setdefault('develop', '.')
return buildout