11from setuptools import setup , find_packages
22import ucoinpy
3+ import os
4+ import re
35
6+ def which (program ):
7+ """
8+ Detect whether or not a program is installed.
9+ Thanks to http://stackoverflow.com/a/377028/70191
10+ """
11+ def is_exe (fpath ):
12+ return os .path .exists (fpath ) and os .access (fpath , os .X_OK )
13+
14+ fpath , _ = os .path .split (program )
15+ if fpath :
16+ if is_exe (program ):
17+ return program
18+ else :
19+ for path in os .environ ['PATH' ].split (os .pathsep ):
20+ exe_file = os .path .join (path , program )
21+ if is_exe (exe_file ):
22+ return exe_file
23+
24+ return None
25+
26+ EDITABLE_REQUIREMENT = re .compile (r'^-e (?P<link>(?P<vcs>git|svn|hg|bzr).+#egg=(?P<package>.+)-(?P<version>\d(?:\.\d)*))$' )
27+
28+ install_requires = []
29+ dependency_links = []
30+
31+ for requirement in (l .strip () for l in open ('requirements.txt' )):
32+ match = EDITABLE_REQUIREMENT .match (requirement )
33+ if match :
34+ assert which (match .group ('vcs' )) is not None , \
35+ "VCS '%(vcs)s' must be installed in order to install %(link)s" % match .groupdict ()
36+ install_requires .append ("%(package)s==%(version)s" % match .groupdict ())
37+ dependency_links .append (match .group ('link' ))
38+ else :
39+ install_requires .append (requirement )
40+
441setup (
542 name = 'ucoinpy' ,
643
1552 description = "A python implementation of [uCoin](https://github.com/ucoin-io/ucoin) API" ,
1653
1754 long_description = open ('README.md' ).read (),
18-
55+
1956 # Active la prise en compte du fichier MANIFEST.in
2057 include_package_data = True ,
2158 url = 'https://github.com/ucoin-io/ucoin-python-api' ,
3067 "Programming Language :: Python :: 3.4" ,
3168 "Topic :: Communications" ,
3269 ],
70+ install_requires = install_requires ,
71+ dependency_links = dependency_links
3372
3473
3574)
0 commit comments