-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use --install-options to select drivers to install
- Loading branch information
Showing
1 changed file
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,53 @@ | |
|
||
from setuptools import setup, find_packages | ||
from pip.req import parse_requirements | ||
from itertools import chain | ||
|
||
import sys | ||
|
||
__author__ = 'David Barroso <[email protected]>' | ||
|
||
install_reqs = parse_requirements('requirements/all', session=uuid.uuid1()) | ||
reqs = [str(ir.req) for ir in install_reqs] | ||
|
||
def extract_drivers(opt): | ||
return set([r.replace("--drivers=", "").strip() for r in opt.split(",")]) | ||
|
||
|
||
def process_requirements(): | ||
develop = False | ||
if 'egg_info' in sys.argv: | ||
return [] | ||
elif 'develop' in sys.argv: | ||
develop = True | ||
|
||
requirements = set() | ||
for r in sys.argv: | ||
if r.startswith("--drivers"): | ||
requirements |= extract_drivers(r) | ||
|
||
# let's remove the options | ||
sys.argv = [o for o in sys.argv if not o.startswith("--drivers")] | ||
|
||
requirements = requirements or set(['all']) | ||
requirements.add('base') | ||
|
||
u = uuid.uuid1() | ||
|
||
iter_reqs = chain(*[parse_requirements("requirements/{}".format(r), session=u) | ||
for r in requirements]) | ||
|
||
if develop: | ||
import pip | ||
[pip.main(['install', (str(ir.req))]) for ir in iter_reqs] | ||
|
||
return [str(ir.req) for ir in iter_reqs] | ||
|
||
|
||
reqs = process_requirements() | ||
|
||
|
||
setup( | ||
name="napalm", | ||
version='2.00.0-alpha-1', | ||
version='2.0.0a1', | ||
packages=find_packages(exclude=("test*", )), | ||
test_suite='test_base', | ||
author="David Barroso, Kirk Byers, Mircea Ulinic", | ||
|