One of the tools to create a Python box garden environment is buildout. I wrote a Makefile to create a buildout environment
It is assumed that Python and virtualenv are already available.
The expected commands are:
make does make build.
Makefile
I often use Makefiles when running buildouts. The following example describes the minimum required operations.
Makefile
# -*- coding: utf-8 -*-
# Need virtualenv
.PHONY: all clean build rebuild
all: env bin/buildout build
echo "buildout finished..."
clean:
rm -rf bin parts eggs develop-eggs .installed env bootstrap.py
build: bin/buildout
bin/buildout -c buildout.cfg
rebuild: clean build
echo
bin/buildout: env
curl https://raw.githubusercontent.com/buildout/buildout/master/bootstrap/bootstrap.py | env/bin/python
env:
virtualenv --no-site-packages env
env/bin/pip install -U setuptools
buildout.cfg You need the configuration file buyout.cfg for buildout. This setting does nothing.
buildout.cfg
[buildout]
parts =
The file has the above Makefile and buildout.cfg in the same directory.
(py3k)$ ls
Makefile buildout.cfg
Let's create a make build.
(py3k)$ make build
virtualenv --no-site-packages env
Using real prefix '/home/examples/.anyenv/envs/pyenv/versions/3.4.2'
New python executable in env/bin/python3.4
Also creating executable in env/bin/python
Installing setuptools, pip...done.
env/bin/pip install -U setuptools
You are using pip version 6.0.3, however version 6.0.6 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
DEPRECATION: --download-cache has been deprecated and will be removed in the future. Pip now automatically uses and configures its cache.
Collecting setuptools from https://pypi.python.org/packages/3.4/s/setuptools/setuptools-11.3.1-py2.py3-none-any.whl#md5=59cd761f2f2b926313bed7f83337e4d7
Downloading setuptools-11.3.1-py2.py3-none-any.whl (500kB)
100% |################################| 503kB 7.3MB/s
Installing collected packages: setuptools
Found existing installation: setuptools 8.2.1
Uninstalling setuptools-8.2.1:
Successfully uninstalled setuptools-8.2.1
Successfully installed setuptools-11.3.1
curl https://raw.githubusercontent.com/buildout/buildout/master/bootstrap/bootstrap.py > bootstrap.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6501 100 6501 0 0 17982 0 --:--:-- --:--:-- --:--:-- 18008
env/bin/python bootstrap.py
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/bin'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/parts'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/eggs'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/develop-eggs'.
Generated script '/home/examples/ng/var/src/develop/examples/buildout/simple/bin/buildout'.
bin/buildout -c buildout.cfg
(py3k)$
Let's check inside the working directory.
(py3k)$ ls
Makefile bin buildout.cfg develop-eggs eggs env parts
(py3k)$ make clean
rm -rf bin parts eggs develop-eggs .installed env bootstrap.py
Confirm that you have deleted it.
(py3k)$ ls
Makefile buildout.cfg
At this time, the environment created by virualenv is also used. It's already rooted.
Now let's run build rebuild.
(py3k)$ make rebuild
rm -rf bin parts eggs develop-eggs .installed env bootstrap.py
virtualenv --no-site-packages env
Using real prefix '/home/examples/.anyenv/envs/pyenv/versions/3.4.2'
New python executable in env/bin/python3.4
Also creating executable in env/bin/python
Installing setuptools, pip...done.
env/bin/pip install -U setuptools
You are using pip version 6.0.3, however version 6.0.6 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
DEPRECATION: --download-cache has been deprecated and will be removed in the future. Pip now automatically uses and configures its cache.
Collecting setuptools from https://pypi.python.org/packages/3.4/s/setuptools/setuptools-11.3.1-py2.py3-none-any.whl#md5=59cd761f2f2b926313bed7f83337e4d7
Downloading setuptools-11.3.1-py2.py3-none-any.whl (500kB)
100% |################################| 503kB 3.4MB/s
Installing collected packages: setuptools
Found existing installation: setuptools 8.2.1
Uninstalling setuptools-8.2.1:
Successfully uninstalled setuptools-8.2.1
Successfully installed setuptools-11.3.1
curl https://raw.githubusercontent.com/buildout/buildout/master/bootstrap/bootstrap.py > bootstrap.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6501 100 6501 0 0 16741 0 --:--:-- --:--:-- --:--:-- 16755
env/bin/python bootstrap.py
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/bin'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/parts'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/eggs'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/develop-eggs'.
Generated script '/home/examples/ng/var/src/develop/examples/buildout/simple/bin/buildout'.
bin/buildout -c buildout.cfg
echo
(py3k)$
All I'm doing is do make clean and then make build.
Recommended Posts