Skip to content

Commit

Permalink
Removed unneeded pth option
Browse files Browse the repository at this point in the history
  • Loading branch information
reinout committed Jun 6, 2015
1 parent 39ad947 commit a41e782
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 79 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Expand Up @@ -24,6 +24,9 @@ Changes
- 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
47 changes: 0 additions & 47 deletions README.rst
Expand Up @@ -55,10 +55,6 @@ extra-paths
path for the `bin/*` scripts. Use this if you have code somewhere without a
proper ``setup.py``.

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.

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
Expand Down Expand Up @@ -135,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
15 changes: 0 additions & 15 deletions src/djangorecipe/recipe.py
Expand Up @@ -145,23 +145,8 @@ def make_wsgi_script(self, extra_paths, ws):

def get_extra_paths(self):
extra_paths = [self.buildout['buildout']['directory']]

# Add libraries found by a site .pth files to our extra-paths.
if 'pth-files' in self.options:
import site
for pth_file in self.options['pth-files'].splitlines():
pth_libs = site.addsitedir(pth_file, set())
if not pth_libs:
self.log.warning(
"No site *.pth libraries found for pth_file=%s",
pth_file)
else:
self.log.info("Adding *.pth libraries=%s", pth_libs)
self.options['extra-paths'] += '\n' + '\n'.join(pth_libs)

pythonpath = [p.replace('/', os.path.sep) for p in
self.options['extra-paths'].splitlines() if p.strip()]

extra_paths.extend(pythonpath)
return extra_paths

Expand Down
17 changes: 0 additions & 17 deletions src/djangorecipe/tests/tests.py
Expand Up @@ -115,23 +115,6 @@ def test_extra_paths(self, manage, working_set):
self.assertEqual(manage.call_args[0][0][-2:],
['somepackage', 'anotherpackage'])

@mock.patch('zc.recipe.egg.egg.Scripts.working_set',
return_value=(None, []))
@mock.patch('site.addsitedir', return_value=['extra', 'dirs'])
def test_pth_files(self, addsitedir, working_set):

# When a pth-files option is set the recipe will use that to add more
# paths to extra-paths.
self.recipe.options['version'] = '1.0'

# The mock values needed to demonstrate the pth-files option.
self.recipe.options['pth-files'] = 'somedir'
self.recipe.install()

self.assertEqual(addsitedir.call_args, (('somedir', set([])), {}))
# The extra-paths option has been extended.
self.assertEqual(self.recipe.options['extra-paths'], '\nextra\ndirs')

def test_settings_option(self):
# The settings option can be used to specify the settings file
# for Django to use. By default it uses `development`.
Expand Down

0 comments on commit a41e782

Please sign in to comment.