diff --git a/build.py b/build.py deleted file mode 100644 index ac3c489e3..000000000 --- a/build.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function -import os -import sys -import shutil -from subprocess import call - - -def x(cmd): - print('$ '+cmd) - res = call(cmd, shell=True) - if res != 0: - sys.exit(res) - - -if len(sys.argv) < 2: - print('usage: %s []') - sys.exit(1) - - -install_mode = sys.argv[1] - - -if install_mode == 'prepare': - x('python pip-clear.py') - - pip_date = len(sys.argv) > 2 and sys.argv[2] - if pip_date: - x('python pip-date.py %s pip setuptools wheel six' % pip_date) - - x('pip install -r requirements.txt') - x('pip list') - - -elif install_mode == 'pip': - if os.path.exists('dist'): - shutil.rmtree('dist') - x('python setup.py sdist') - x('python pip-clear.py') - - filenames = os.listdir('dist') - assert len(filenames) == 1 - x('pip list') - x('pip install dist/%s' % filenames[0]) - - -elif install_mode == 'setup-install': - x('python setup.py install') - - -elif install_mode == 'setup-develop': - x('pip install -e .') - - -elif install_mode == 'test': - x('pip install pytest') - x('pip list') - - if os.path.exists('tmp'): - shutil.rmtree('tmp') - os.mkdir('tmp') - - try: - old = os.getcwd() - os.chdir('tmp') - - x('python -m spacy.en.download') - x('python -m pytest --tb="native" ../spacy/ -x --models --vectors --slow') - - finally: - os.chdir(old) diff --git a/buildbot.json b/buildbot.json new file mode 100644 index 000000000..93c3a9514 --- /dev/null +++ b/buildbot.json @@ -0,0 +1,19 @@ +{ + "build": { + "sdist": [ + "python pip-clear.py", + "pip install -r requirements.txt", + "python setup.py sdist" + ], + "install": [ + "python pip-clear.py", + "pip install source.tar.gz", + "python -m spacy.en.download --force" + ] + }, + "test": { + "after": ["install"], + "package": "spacy", + "args": "--tb='native' -x --models --vectors --slow" + } +} diff --git a/pip-clear.py b/pip-clear.py deleted file mode 100755 index 573a20dcd..000000000 --- a/pip-clear.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function - -from pip.commands.uninstall import UninstallCommand -from pip import get_installed_distributions - - -packages = [] -for package in get_installed_distributions(): - if package.location.endswith('dist-packages'): - continue - elif package.project_name in ('pip', 'setuptools'): - continue - packages.append(package.project_name) - - -if packages: - pip = UninstallCommand() - options, args = pip.parse_args(packages) - options.yes = 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) diff --git a/pip-date.py b/pip-date.py deleted file mode 100644 index 2a775255a..000000000 --- a/pip-date.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function -import json -import re -import sys -from bisect import bisect -from datetime import datetime -from datetime import timedelta -import ssl - -try: - from urllib.request import Request, build_opener, HTTPSHandler, URLError -except ImportError: - from urllib2 import Request, build_opener, HTTPSHandler, URLError - -from pip.commands.uninstall import UninstallCommand -from pip.commands.install import InstallCommand -from pip import get_installed_distributions - - -def get_releases(package_name): - url = 'https://pypi.python.org/pypi/%s/json' % package_name - - ssl_context = HTTPSHandler( - context=ssl.SSLContext(ssl.PROTOCOL_TLSv1)) - opener = build_opener(ssl_context) - - retries = 10 - while retries > 0: - try: - r = opener.open(Request(url)) - break - except URLError: - retries -= 1 - - return json.loads(r.read().decode('utf8'))['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] - - -installed_packages = [ - package.project_name - for package in - get_installed_distributions() - if (not package.location.endswith('dist-packages') and - package.project_name not in ('pip', 'setuptools')) -] - -if installed_packages: - pip = UninstallCommand() - options, args = pip.parse_args(installed_packages) - options.yes = 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) - - -date = parse_iso8601(sys.argv[1]) -packages = {p: select_version(date, p) for p in sys.argv[2:]} -args = ['=='.join(a) for a in packages.items()] - -cmd = InstallCommand() -options, args = cmd.parse_args(args) -options.ignore_installed = True -options.force_reinstall = True - -try: - print(cmd.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) diff --git a/venv.ps1 b/venv.ps1 deleted file mode 100644 index 4fd5c157c..000000000 --- a/venv.ps1 +++ /dev/null @@ -1,32 +0,0 @@ -param ( - [string]$python = $(throw "-python is required."), - [string]$install_mode = $(throw "-install_mode is required."), - [string]$pip_date, - [string]$compiler -) - -$ErrorActionPreference = "Stop" - -if(!(Test-Path -Path ".build")) -{ - if($compiler -eq "mingw32") - { - virtualenv .build --system-site-packages --python $python - } - else - { - virtualenv .build --python $python - } - - if($compiler) - { - "[build]`r`ncompiler=$compiler" | Out-File -Encoding ascii .\.build\Lib\distutils\distutils.cfg - } -} - -.build\Scripts\activate.ps1 - -python build.py prepare $pip_date -python build.py $install_mode -python build.py test -exit $LASTEXITCODE diff --git a/venv.sh b/venv.sh deleted file mode 100755 index 8852a5ba0..000000000 --- a/venv.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -e - -if [ ! -d ".build" ]; then - virtualenv .build --python $1 -fi - -if [ -d ".build/bin" ]; then - source .build/bin/activate -elif [ -d ".build/Scripts" ]; then - source .build/Scripts/activate -fi - -python build.py prepare $3 -python build.py $2 -python build.py test