1

So I'm using PasteScript's paster, and I'm trying to automate egg creation. My first step is to get a template of a Python egg. I noticed that PasteScript's paster has one built in, so I've been creating my template from the command line:

$paster create -t basic_package

However, this asks me the questions as a series of prompts (Project Name, Author, Version, etc). Is it possible to use a configuration file or a pass the argument directly into the command line when invoking PasteScript?

My goal is to have one command that I can run to generate an egg template.

Thanks for the help!

DrakeAnderson
  • 492
  • 4
  • 12

1 Answers1

4

I recently discovered this myself. The "paster create" takes a --config command line argument. This can be a file which contains the variable to use.

For example:

I will create a package called bob from config called bobsetup.cfg. The configuration file will contain:

[pastescript]
created = 2011-09-07T14:47:27
egg_plugins__eval__ = []
plus = +
egg = bob
dot = .
description = Bob's magic code
license_name =
zip_safe__eval__ = False
keywords = Python
long_description = Bob's super useful code base
author = Fred Sprocket
author_email = fred.sprocket@example.com
url = http://example.com
version = 1.0.0

I can then use this as follows:

$ paster create -t basic_package --config=bobsetup.cfg bob

Selected and implied templates:
  PasteScript#basic_package  A basic setuptools-enabled package

Variables:
  author:            Fred Sprocket
  author_email:      fred.sprocket@example.com
  created:           2011-09-07T14:47:27
  description:       Bob's magic code
  dot:               .
  egg:               bob
  egg_plugins:       []
  keywords:          Python
  license_name:
  long_description:  Bob's super useful code base
  package:           bob
  plus:              +
  project:           bob
  url:               http://example.com
  version:           1.0
  zip_safe:          False
Creating template basic_package
Creating directory ./bob
  Recursing into +package+
    Creating ./bob/bob/
    Copying __init__.py to ./bob/bob/__init__.py
  Copying setup.cfg to ./bob/setup.cfg
  Copying setup.py_tmpl to ./bob/setup.py
Running /Users/omul/.virtualenvs/im.analytics/bin/python setup.py egg_info

$

If I check the bob/setup.py you can see this has set up the variables. cat setup.py:

from setuptools import setup, find_packages
import sys, os

version = '1.0'

setup(name='bob',
      version=version,
      description="Bob's magic code",
      long_description="""\
Bob's super useful code base""",
      classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
      keywords='Python',
      author='Fred Sprocket',
      author_email='fred.sprocket@example.com',
      url='http://example.com',
      license='',
      packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
      include_package_data=True,
      zip_safe=False,
      install_requires=[
          # -*- Extra requirements: -*-
      ],
      entry_points="""
      # -*- Entry points: -*-
      """,
      )
Oisin
  • 1,483
  • 12
  • 15