Skip to content
This repository has been archived by the owner on Dec 17, 2020. It is now read-only.

Commit

Permalink
add PasteScript egg if it's not there to make sure it's installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Groszer committed Jan 28, 2010
1 parent 843f0ee commit 3f767d8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ CHANGES
0.5.2dev (unreleased)
---------------------

- Fix: add PasteScript egg if it's not there to make sure it's installed

0.5.1 (2010-01-22)
------------------

Expand Down
8 changes: 6 additions & 2 deletions src/z3c/recipe/paster/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ generated script uses the ``paste.script.command.run`` for starting our server:
<BLANKLINE>
import sys
sys.path[0:0] = [
'...demo',
'/sample-buildout/demo',
'/sample-pyN.N.egg',
...
'/sample-pyN.N.egg',
]
<BLANKLINE>
import os
Expand All @@ -129,6 +132,8 @@ generated script uses the ``paste.script.command.run`` for starting our server:
'serve', '...myapp.ini',
]+sys.argv[1:])

Those ``sample-pyN.N.egg`` lines should be PasteScript and it's dependencies.

Check the content of our new generated myapp.ini file:

>>> cat('parts', 'myapp', 'myapp.ini')
Expand Down Expand Up @@ -170,4 +175,3 @@ your custom setup.py file like::
main = z3c.recipe.paster.wsgi:application_factory
""",
)

3 changes: 3 additions & 0 deletions src/z3c/recipe/paster/debug.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ Check the content of our new generated script.
import sys
sys.path[0:0] = [
'/sample-buildout/sample',
'/sample-pyN.N.egg',
...
'/sample-pyN.N.egg',
]
<BLANKLINE>
import z3c.recipe.paster.debug
Expand Down
6 changes: 4 additions & 2 deletions src/z3c/recipe/paster/paster.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ def __init__(self, buildout, name, options):
raise zc.buildout.UserError(
'You have to define at least one egg for setup a paster.')

# add PasteScript egg
options['eggs'] = '%s\nPasteScript' % options.get('eggs')
if 'PasteScript' not in options.get('eggs'):
# add PasteScript egg
options['eggs'] = '%s\nPasteScript' % options.get('eggs')

super(PasterSetup, self).__init__(buildout, name, options)
self.egg = zc.recipe.egg.Egg(buildout, name, options)

Expand Down
12 changes: 9 additions & 3 deletions src/z3c/recipe/paster/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,22 @@ def __init__(self, buildout, name, options):
self.buildout = buildout
self.name = name
self.options = options

if options.get('eggs') is None:
raise zc.buildout.UserError(
'You have to define at least one egg for setup an application.')

if 'PasteScript' not in options.get('eggs'):
# add PasteScript egg
options['eggs'] = '%s\nPasteScript' % options.get('eggs')

options['script'] = os.path.join(buildout['buildout']['bin-directory'],
options.get('script', self.name),
)
if not options.get('working-directory', ''):
options['location'] = os.path.join(
buildout['buildout']['parts-directory'], name)

if options.get('eggs') is None:
raise zc.buildout.UserError(
'You have to define at least one egg for setup an application.')
self.egg = zc.recipe.egg.Egg(buildout, name, options)

def install(self):
Expand Down

0 comments on commit 3f767d8

Please sign in to comment.