mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
get travis running
This commit is contained in:
parent
9135f61172
commit
06dab0e1b7
|
@ -12,14 +12,11 @@ os:
|
|||
- linux
|
||||
|
||||
env:
|
||||
- SETUPTOOLS=19
|
||||
- SETUPTOOLS=18
|
||||
- SETUPTOOLS=17
|
||||
- DATE=2015-01-01
|
||||
|
||||
install:
|
||||
- pip install -U pip
|
||||
- pip uninstall -y setuptools
|
||||
- pip install "setuptools<$SETUPTOOLS"
|
||||
- python pip-date.py $DATE
|
||||
- pip list
|
||||
- pip install -r requirements.txt
|
||||
- python setup.py sdist
|
||||
- pip install dist/*
|
||||
|
|
53
pip-date.py
Normal file
53
pip-date.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
import urllib
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from bisect import bisect
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
|
||||
from pip.commands.install import InstallCommand
|
||||
|
||||
|
||||
def get_releases(package_name):
|
||||
url = 'https://pypi.python.org/pypi/%s/json' % package_name
|
||||
return json.load(urllib.urlopen(url))['releases']
|
||||
|
||||
|
||||
def parse_iso8601(s):
|
||||
return datetime(*map(int, re.split('[^\d]', s)))
|
||||
|
||||
|
||||
def select_version(select_date, package_name):
|
||||
versions = []
|
||||
for version, dists in get_releases(package_name).items():
|
||||
date = [parse_iso8601(d['upload_time']) for d in dists]
|
||||
if date:
|
||||
versions.append((sorted(date)[0], version))
|
||||
|
||||
versions = sorted(versions)
|
||||
min_date = versions[0][0]
|
||||
if select_date < min_date:
|
||||
raise Exception('invalid select_date: %s, must be '
|
||||
'%s or newer.' % (select_date, min_date))
|
||||
|
||||
return versions[bisect([x[0] for x in versions], select_date) - 1][1]
|
||||
|
||||
|
||||
date = parse_iso8601(sys.argv[1])
|
||||
args = ['%s==%s' % (p, select_version(date, p)) for p in sys.argv[2:]]
|
||||
|
||||
pip = InstallCommand()
|
||||
options, args = pip.parse_args(args)
|
||||
options.force_reinstall = True
|
||||
options.ignore_installed = True
|
||||
|
||||
try:
|
||||
pip.run(options, args)
|
||||
except OSError as e:
|
||||
if e.errno != 13:
|
||||
raise e
|
||||
print("You lack permissions to uninstall this package. Perhaps run with sudo? Exiting.")
|
||||
exit(13)
|
Loading…
Reference in New Issue
Block a user