Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
Use vars and template_main parameters in main function so it can be r…
Browse files Browse the repository at this point in the history
…eused

in dolmenproject.
  • Loading branch information
vincentfretin committed Dec 31, 2010
1 parent fe0c91a commit 5c05650
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -6,6 +6,8 @@ Changes

- Added include_site_packages, install_requires, and additional_grants
variables in the template for use in dolmenproject.
Use vars and template_main parameters in main function so it can be reused
in dolmenproject.

2.2 (2010-11-26)
----------------
Expand Down
8 changes: 4 additions & 4 deletions grokproject/main.py
Expand Up @@ -7,7 +7,7 @@

project_name_re=re.compile('[a-zA-Z_][a-zA-Z0-9_]*')

def main():
def main(vars=GrokProject.vars, template_name='grok'):
usage = "usage: %prog [options] PROJECT"
parser = optparse.OptionParser(usage=usage)
parser.add_option(
Expand All @@ -28,7 +28,7 @@ def main():
help="Show grokproject version.")

# Options that override the interactive part of filling the templates.
for var in GrokProject.vars:
for var in vars:
option_name = '--'+var.name.replace('_', '-')
if not parser.has_option(option_name):
parser.add_option(
Expand Down Expand Up @@ -60,7 +60,7 @@ def main():
# Process the options that override the interactive part of filling
# the templates.
extra_args = []
for var in GrokProject.vars:
for var in vars:
supplied_value = getattr(options, var.name)
if supplied_value is not None:
extra_args.append('%s=%s' % (var.name, supplied_value))
Expand All @@ -76,7 +76,7 @@ def main():
sys.exit(1)

# Create the project.
exit_code = runner.run(option_args + ['-t', 'grok', project] + extra_args)
exit_code = runner.run(option_args + ['-t', template_name, project] + extra_args)
sys.exit(exit_code)

def get_version():
Expand Down

0 comments on commit 5c05650

Please sign in to comment.