Skip to content

Commit b5e11a0

Browse files
author
Matthew Peters
committed
Add a Vagrantfile
1 parent fbadd44 commit b5e11a0

File tree

5 files changed

+81
-21
lines changed

5 files changed

+81
-21
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ output/*
2121
# vim temp files
2222
*.swp
2323

24+
.vagrant
25+

.travis.yml

+3-11
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,7 @@ script: make test
55
cache:
66
- apt
77
- pip
8-
install:
9-
- sudo apt-get -y install libatlas-base-dev libatlas-dev lib{blas,lapack}-dev
10-
- sudo apt-get -y install libxslt-dev libxml2-dev
11-
# some conda magic to install numpy, scipy
12-
# see http://sburns.org/2014/03/28/faster-travis-builds.html
13-
- sudo pip install conda
14-
- conda_deps='pip numpy scipy'
15-
- conda create -p $HOME/py --yes $conda_deps "python=$TRAVIS_PYTHON_VERSION"
8+
install: ./provision.sh
9+
script:
1610
- export PATH=$HOME/py/bin:$PATH
17-
- pip install Cython>=0.21.1
18-
- pip install -r requirements.txt
19-
- python setup.py build_ext --inplace
11+
- make test

README.md

+34-10
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,45 @@ Otherwise, we try to guess the encoding from a `meta` tag or specified
5858

5959
## Installing
6060

61-
The build requires numpy, lxml and a new version of Cython, so first make sure
62-
they are installed, then install Dragnet:
63-
64-
```
65-
pip install numpy
66-
pip install --upgrade cython
67-
pip install lxml
68-
pip install dragnet
69-
```
70-
7161
Dragnet is written in Python (developed with 2.7, not tested on 3)
7262
and built on the numpy/scipy/Cython numerical computing environment.
7363
In addition we use <a href="http://lxml.de/">lxml</a> (libxml2)
7464
for HTML parsing.
7565

66+
We recommend installing from the master branch to ensure you have the latest
67+
version.
68+
69+
### Installing vagrant:
70+
71+
1. Install [vagrant](https://www.vagrantup.com/downloads.html).
72+
2. Install [Virtual Box](https://www.virtualbox.org/wiki/Downloads).
73+
3. Clone the master branch: `git clone [email protected]:seomoz/dragnet.git`
74+
4. Bring up the vagrant box: `vagrant up --provider=virtualbox`
75+
5. Log into the vagrant box:
76+
77+
```bash
78+
vagrant ssh
79+
# inside the vagrant vm
80+
$ cd /vagrant
81+
# these should now pass
82+
$ make test
83+
```
84+
85+
### Installing without vagrant
86+
87+
1. Install numpy, a new version of Cython and [lxml](http://lxml.de/installation.html). You can install numpy and cython with pip, but lxml may require some
88+
additional packages (libxml2).
89+
2. Clone the master branch: `git clone [email protected]:seomoz/dragnet.git`
90+
3. Install the requirements: `sudo pip install -r dragnet/requirements.txt`
91+
4. Build dragnet
92+
93+
```bash
94+
$ cd dragnet
95+
$ sudo make install
96+
# these should now pass
97+
$ make test
98+
```
99+
76100
# Contributing
77101

78102
We love contributions! We are especially looking for someone who would

Vagrantfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure(2) do |config|
5+
config.vm.box = "ubuntu/trusty64"
6+
7+
# lxml has trouble building if the amount of memory is 512:
8+
# http://stackoverflow.com/questions/16149613/installing-lxml-with-pip-in-virtualenv-ubuntu-12-10-error-command-gcc-failed
9+
config.vm.provider "virtualbox" do |vb|
10+
vb.memory = "1024"
11+
end
12+
13+
config.vm.provision "shell", privileged: false, inline: <<-SHELL
14+
cd /vagrant; ./provision.sh
15+
SHELL
16+
end

provision.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
# die on error
3+
set -e
4+
5+
sudo apt-get update
6+
7+
sudo apt-get -y install libatlas-base-dev libatlas-dev lib{blas,lapack}-dev
8+
sudo apt-get -y install libxslt-dev libxml2-dev gcc g++
9+
10+
# According to `conda list`, pip installing conda isn't the way to go. Instead, use this:
11+
curl -O http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
12+
bash Miniconda3-latest-Linux-x86_64.sh -b
13+
rm Miniconda3-latest-Linux-x86_64.sh
14+
export PATH=$HOME/miniconda3/bin:$PATH
15+
conda_deps='pip numpy scipy'
16+
conda create -m -p $HOME/py --yes $conda_deps python=2.7
17+
export PATH=$HOME/py/bin:$PATH
18+
19+
# configure conda for future login
20+
echo "export PATH=$PATH" >> $HOME/.bashrc
21+
22+
pip install "Cython>=0.21.1"
23+
pip install -r requirements.txt
24+
25+
make install
26+

0 commit comments

Comments
 (0)