-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
79 lines (68 loc) · 2.45 KB
/
Copy pathsetup.py
File metadata and controls
79 lines (68 loc) · 2.45 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"""Setup script for ip2api."""
from setuptools import setup
import codecs
import os
import sys
HERE = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
"""Return multiple read calls to different readable objects as a single
string."""
return codecs.open(os.path.join(HERE, *parts), 'r').read()
LONG_DESCRIPTION = read('README.rst')
def install_deps():
"""Reads requirements.txt and preprocess it
to be feed into setuptools.
This is the only possible way (we found)
how requirements.txt can be reused in setup.py
using dependencies from private github repositories.
Links must be appendend by `-{StringWithAtLeastOneNumber}`
or something like that, so e.g. `-9231` works as well as
`1.1.0`. This is ignored by the setuptools, but has to be there.
Warnings:
to make pip respect the links, you have to use
`--process-dependency-links` switch. So e.g.:
`pip install --process-dependency-links {git-url}`
Returns:
list of packages and dependency links.
"""
default = read('requirements.txt').splitlines()
new_pkgs = []
links = []
for resource in default:
if 'git+https' in resource:
pkg = resource.split('#')[-1]
links.append(resource.strip() + '-9876543210')
new_pkgs.append(pkg.replace('egg=', '').rstrip())
else:
new_pkgs.append(resource.strip())
return new_pkgs, links
pkgs, new_links = install_deps()
setup(
name='ip2api',
version='1.2.1',
url='http://github.com/radusuciu/ip2api/',
license='Apache Software License',
author='Radu Suciu',
install_requires=pkgs,
dependency_links=new_links,
author_email='radusuciu@gmail.com',
description='Simple interface for IP2',
long_description=LONG_DESCRIPTION,
packages=['ip2api'],
include_package_data=True,
platforms='any',
zip_safe=True,
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Development Status :: 4 - Beta',
'Natural Language :: English',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Bio-Informatics'
],
)