diff --git a/build.py b/build.py new file mode 100644 index 000000000..be016a30e --- /dev/null +++ b/build.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +from __future__ import print_function +import os +import sys +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] +pip_date = len(sys.argv) > 2 and sys.argv[2] + + +x('pip install -U pip') +if pip_date: + x('python pip-date.py %s pip setuptools wheel six' % pip_date) +x('pip install -r requirements.txt') + +if install_mode == 'pip': + x('python setup.py sdist') + x('pip install dist/*') + +elif install_mode == 'setup-install': + x('python setup.py install') + +elif install_mode == 'setup-develop': + x('python setup.py develop') + x('pip install -e .') + +x('pip install pytest') +x('pip list') + +if not os.path.exists('tmp'): + os.mkdir('tmp') + +try: + old = os.getcwd() + os.chdir('tmp') + + x('python -m spacy.en.download') + x('python -m pytest ../spacy/ -x --models --vectors --slow') + +finally: + os.chdir(old) diff --git a/build.sh b/build.sh deleted file mode 100755 index 1fe9256a2..000000000 --- a/build.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -x -set -e - -if [[ $# < 2 ]]; then - echo "usage: $0 []" - exit -fi - -if [ ! -d ".build" ]; then - virtualenv .build --python $1 -fi -. .build/bin/activate - -# install -pip install -U pip - -if [ -n "${3+1}" ]; then - python pip-date.py $3 pip setuptools wheel six -fi - -pip install -r requirements.txt -if [[ "$2" == "pip" ]]; then - python setup.py sdist; - pip install dist/*; -fi -if [[ "$2" == "setup-install" ]]; then - python setup.py install; -fi -if [[ "$2" == "setup-develop" ]]; then - python setup.py develop; - pip install -e .; -fi -pip install pytest -pip list - -# script -cd .build -python -m spacy.en.download -python -m pytest ../spacy/ -x --models --vectors --slow diff --git a/venv.ps1 b/venv.ps1 new file mode 100644 index 000000000..7ca6fb6bb --- /dev/null +++ b/venv.ps1 @@ -0,0 +1,13 @@ +param ( + [string]$python = $(throw "-python is required."), + [string]$install_mode = $(throw "-install_mode is required."), + [string]$pip_date +) + +if(!(Test-Path -Path ".build")) +{ + virtualenv .build --python $python +} +.build\Scripts\activate.ps1 + +python build.py $python $install_mode $pip_date diff --git a/venv.sh b/venv.sh new file mode 100755 index 000000000..832d90b43 --- /dev/null +++ b/venv.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +if [ ! -d ".build" ]; then + virtualenv .build --python $1 +fi + +. .build/bin/activate +python build.py $2 $3