Eines der Tools zum Erstellen einer Python-Miniaturgartenumgebung ist das Erstellen. Ich habe ein Makefile geschrieben, um eine Buildout-Umgebung zu erstellen
Es wird davon ausgegangen, dass Python und virtualenv bereits verfügbar sind.
Die erwarteten Befehle sind:
make macht make build.
Makefile
Ich benutze oft Makefile, wenn ich Buildout ausführe. Das folgende Beispiel beschreibt die minimal erforderlichen Operationen.
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 Sie benötigen die Konfigurationsdatei buyout.cfg für den Buildout. Diese Einstellung bewirkt nichts.
buildout.cfg
[buildout]
parts =
Die Datei enthält das obige Makefile und buildout.cfg im selben Verzeichnis.
(py3k)$ ls
Makefile buildout.cfg
Lassen Sie uns einen Make Build erstellen.
(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)$
Lassen Sie uns im Arbeitsverzeichnis nachsehen.
(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
Bestätigen Sie, dass Sie es gelöscht haben.
(py3k)$ ls
Makefile buildout.cfg
Zu diesem Zeitpunkt wird auch die von virualenv erstellte Umgebung verwendet. Es ist bereits verwurzelt.
Lassen Sie uns nun Build Rebuild ausführen.
(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)$
Ich mache nur sauber und baue dann.