Skip to content

Commit

Permalink
Merge pull request #89 from rvanlaar/reinout-remove-templates
Browse files Browse the repository at this point in the history
Remove project generation, update to 1.4/1.7/1.8
  • Loading branch information
reinout committed Jun 6, 2015
2 parents 8097621 + a58eecb commit c380fa2
Show file tree
Hide file tree
Showing 18 changed files with 254 additions and 755 deletions.
2 changes: 2 additions & 0 deletions .landscape.yml
@@ -0,0 +1,2 @@
ignore-paths:
- bootstrap.py
10 changes: 4 additions & 6 deletions .travis.yml
@@ -1,12 +1,10 @@
language: python
env:
- DJANGO_VERSION=1.4
- DJANGO_VERSION=1.5
- DJANGO_VERSION=1.6
- DJANGO_VERSION=1.7
- DJANGO_VERSION=1.8
python:
- 2.6
- 2.7
- 3.2
- 3.3
- pypy
install:
Expand All @@ -16,7 +14,7 @@ script:
matrix:
allow_failures:
- python: pypy
- python: 3.2
env: "DJANGO_VERSION=1.4"
- python: 3.3
env: "DJANGO_VERSION=1.4"
- python: 3.4
env: "DJANGO_VERSION=1.4"
24 changes: 22 additions & 2 deletions CHANGES.rst
Expand Up @@ -2,10 +2,30 @@ Changes
=======


1.12 (unreleased)
2.0 (unreleased)
-----------------

- Nothing changed yet.
- Removed project generation. Previously, djangorecipe would generate a
directory for you from a template, but Django's own template is more than
good enough now. Especially: it generates a subdirectory for your project
now. Just run ``bin/django startproject <projectname>``.

See django's documentation for `startproject
<https://docs.djangoproject.com/en/1.8/ref/django-admin/#django-admin-startproject>`_.

You can also look at `cookiecutter <https://cookiecutter.readthedocs.org/>`_.

This also means the ``projectegg`` option is now deprecated, it isn't needed
anymore.

- We aim at django 1.7 and 1.8 now. Django 1.4 still works, (except that that
one doesn't have a good startproject command).

- The ``wsgilog`` option has been deprecated, the old apache mod_wsgi script
hasn't been used for a long time.

- Removed old pth option, previously used for pinax. Pinax uses proper python
packages since a long time, so it isn't needed anymore.


1.11 (2014-11-21)
Expand Down
10 changes: 5 additions & 5 deletions Makefile
@@ -1,7 +1,7 @@
# Makefile for testing on travis with multiple django versions
# See .travis.yml, it uses the DJANGO_VERSION environment variable.

DJANGO_VERSION ?= 1.5
DJANGO_VERSION ?= 1.8

all: build

Expand All @@ -13,11 +13,11 @@ build:
ifeq ($(DJANGO_VERSION),1.4)
bin/buildout -c buildout14.cfg
endif
ifeq ($(DJANGO_VERSION),1.5)
bin/buildout
ifeq ($(DJANGO_VERSION),1.7)
bin/buildout -c buildout17.cfg
endif
ifeq ($(DJANGO_VERSION),1.6)
bin/buildout -c buildout16.cfg
ifeq ($(DJANGO_VERSION),1.8)
bin/buildout
endif

test:
Expand Down
83 changes: 10 additions & 73 deletions README.rst
Expand Up @@ -21,19 +21,12 @@ You can see an example of how to use the recipe below::
versions = versions

[versions]
Django = 1.5.5

[satchmo]
recipe = gocept.download
url = http://www.satchmoproject.com/snapshots/satchmo-0.6.tar.gz
md5sum = 659a4845c1c731be5cfe29bfcc5d14b1
Django = 1.8.2

[django]
recipe = djangorecipe
settings = development
eggs = ${buildout:eggs}
extra-paths =
${satchmo:location}
project = dummyshop


Expand All @@ -43,13 +36,7 @@ Supported options
The recipe supports the following options.

project
This option sets the name for your project. The recipe will create a
basic structure if the project is not already there.

projectegg
Use this instead of the project option when you want to use an egg
as the project. This disables the generation of the project
structure.
This option sets the name for your project.

settings
You can set the name of the settings file which is to be used with
Expand All @@ -59,27 +46,25 @@ settings

dotted-settings-path
Use this option to specify a custom settings path to be used. By default,
the ``project`` and ``settings`` option values are used, so for instance
``myproject.development``. ``dotted-settings-path =
the ``project`` and ``settings`` option values are concatenated, so for
instance ``myproject.development``. ``dotted-settings-path =
somewhere.else.production`` allows you to customize it.

extra-paths
All paths specified here will be used to extend the default Python
path for the `bin/*` scripts.

pth-files
Adds paths found from a site `.pth` file to the extra-paths.
Useful for things like Pinax which maintains its own external_libs dir.
path for the `bin/*` scripts. Use this if you have code somewhere without a
proper ``setup.py``.

control-script
The name of the script created in the bin folder. This script is the
equivalent of the `manage.py` Django normally creates. By default it
uses the name of the section (the part between the `[ ]`).
uses the name of the section (the part between the `[ ]`). Traditionally,
the part is called ``[django]``.

initialization
Specify some Python initialization code to be inserted into the
`control-script`. This is very limited. In particular, be aware that
leading whitespace is stripped from the code given.
`control-script`. This functionality is very limited. In particular, be
aware that leading whitespace is stripped from the code given.

deploy_script_extra
In the `wsgi` deployment script, you sometimes need to wrap the application
Expand All @@ -96,11 +81,6 @@ wsgi-script
The name of the wsgi-script that is generated. This can be useful for
gunicorn.

wsgilog
In case the WSGI server you're using does not allow printing to stdout,
you can set this variable to a filesystem path - all stdout/stderr data
is redirected to the log instead of printed

test
If you want a script in the bin folder to run all the tests for a
specific set of apps this is the option you would use. Set this to
Expand Down Expand Up @@ -151,49 +131,6 @@ The next example shows you how to use some more of the options::
dotted-settings-path = projectconfig.production.settings


Example using .pth files
-------------------------

Pinax uses a .pth file to add a bunch of libraries to its path; we can
specify it's directory to get the libraries it specified added to our
path::

[buildout]
parts = PIL
svncode
myproject
versions=versions

[versions]
django = 1.3

[PIL]
recipe = zc.recipe.egg:custom
egg = PIL
find-links = http://dist.repoze.org/

[svncode]
recipe = iw.recipe.subversion
urls = http://svn.pinaxproject.com/pinax/tags/0.5.1rc1 pinax

[myproject]
recipe = djangorecipe
eggs =
PIL
project = myproject
settings = settings
extra-paths = ${buildout:directory}/myproject/apps
${svncode:location}/pinax/apps/external_apps
${svncode:location}/pinax/apps/local_apps
pth-files = ${svncode:location}/pinax/libs/external_libs
wsgi = true

Above, we use stock Pinax for pth-files and extra-paths paths for
apps, and our own project for the path that will be found first in the
list. Note that we expect our project to be checked out (e.g., by
svn:external) directly under this directory in to 'myproject'.


Example with a Django version from a repository
---------------------------------------------------

Expand Down
81 changes: 50 additions & 31 deletions bootstrap.py
Expand Up @@ -35,7 +35,7 @@
Simply run this script in a directory containing a buildout.cfg, using the
Python that you want bin/buildout to use.
Note that by using --find-links to point to local resources, you can keep
Note that by using --find-links to point to local resources, you can keep
this script from going over the network.
'''

Expand All @@ -56,39 +56,54 @@
"file to be used."))
parser.add_option("-f", "--find-links",
help=("Specify a URL to search for buildout releases"))
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--setuptools-version",
help="use a specific setuptools version")


options, args = parser.parse_args()

######################################################################
# load/install setuptools

to_reload = False
try:
import pkg_resources
import setuptools
if options.allow_site_packages:
import setuptools
import pkg_resources
from urllib.request import urlopen
except ImportError:
ez = {}

try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen

# XXX use a more permanent ez_setup.py URL when available.
exec(urlopen('https://bitbucket.org/pypa/setuptools/raw/0.7.2/ez_setup.py'
).read(), ez)
setup_args = dict(to_dir=tmpeggs, download_delay=0)
ez['use_setuptools'](**setup_args)

if to_reload:
reload(pkg_resources)
import pkg_resources
# This does not (always?) update the default working set. We will
# do it.
for path in sys.path:
if path not in pkg_resources.working_set.entries:
pkg_resources.working_set.add_entry(path)
from urllib2 import urlopen

ez = {}
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)

if not options.allow_site_packages:
# ez_setup imports site, which adds site packages
# this will remove them from the path to ensure that incompatible versions
# of setuptools are not in the path
import site
# inside a virtualenv, there is no 'getsitepackages'.
# We can't remove these reliably
if hasattr(site, 'getsitepackages'):
for sitepackage_path in site.getsitepackages():
sys.path[:] = [x for x in sys.path if sitepackage_path not in x]

setup_args = dict(to_dir=tmpeggs, download_delay=0)

if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version

ez['use_setuptools'](**setup_args)
import setuptools
import pkg_resources

# This does not (always?) update the default working set. We will
# do it.
for path in sys.path:
if path not in pkg_resources.working_set.entries:
pkg_resources.working_set.add_entry(path)

######################################################################
# Install buildout
Expand Down Expand Up @@ -119,10 +134,15 @@
_final_parts = '*final-', '*final'

def _final_version(parsed_version):
for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts):
return False
return True
try:
return not parsed_version.is_prerelease
except AttributeError:
# Older setuptools
for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts):
return False
return True

index = setuptools.package_index.PackageIndex(
search_path=[setuptools_path])
if find_links:
Expand All @@ -149,8 +169,7 @@ def _final_version(parsed_version):
import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
raise Exception(
"Failed to execute command:\n%s",
repr(cmd)[1:-1])
"Failed to execute command:\n%s" % repr(cmd)[1:-1])

######################################################################
# Import and run buildout
Expand Down
10 changes: 5 additions & 5 deletions buildout.cfg
Expand Up @@ -13,16 +13,16 @@ versions = versions
[versions]
# Specific pin, this one is overwritten in the other buildout configs (for 1.4
# and 1.6).
Django = 1.5.5
Django = 1.8.2

# Pinning versions reported by buildout (for faster running)
collective.recipe.omelette = 0.16
coverage = 3.7
coverage = 3.7.1
mock = 1.0.1
nose = 1.3.0
nose = 1.3.7
pbp.recipe.noserunner = 0.2.6
setuptools = 1.1.6
zc.buildout = 2.2.1
setuptools = 17.0
zc.buildout = 2.3.1
zc.recipe.egg = 2.0.1


Expand Down
2 changes: 1 addition & 1 deletion buildout14.cfg
Expand Up @@ -3,4 +3,4 @@ extends = buildout.cfg


[versions]
Django = 1.4.9
Django = 1.4.20
8 changes: 0 additions & 8 deletions buildout16.cfg

This file was deleted.

6 changes: 6 additions & 0 deletions buildout17.cfg
@@ -0,0 +1,6 @@
[buildout]
extends = buildout.cfg


[versions]
Django = 1.7.8
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -2,7 +2,7 @@

from setuptools import setup, find_packages

version = '1.12.dev0'
version = '2.0.dev0'


def read_file(name):
Expand Down

0 comments on commit c380fa2

Please sign in to comment.