eggs/zc.buildout-1.5.2-py2.6.egg/zc/buildout/setup.txt
changeset 69 c6bca38c1cbf
equal deleted inserted replaced
68:5ff1fc726848 69:c6bca38c1cbf
       
     1 Using zc.buildout to run setup scripts
       
     2 ======================================
       
     3 
       
     4 zc buildout has a convenience command for running setup scripts.  Why?
       
     5 There are two reasons.  If a setup script doesn't import setuptools,
       
     6 you can't use any setuptools-provided commands, like bdist_egg.  When
       
     7 buildout runs a setup script, it arranges to import setuptools before
       
     8 running the script so setuptools-provided commands are available.
       
     9 
       
    10 If you use a squeaky-clean Python to do your development, the setup
       
    11 script that would import setuptools because setuptools isn't in the
       
    12 path.  Because buildout requires setuptools and knows where it has
       
    13 installed a setuptools egg, it adds the setuptools egg to the Python
       
    14 path before running the script.  To run a setup script, use the
       
    15 buildout setup command, passing the name of a script or a directory
       
    16 containing a setup script and arguments to the script.  Let's look at
       
    17 an example:
       
    18 
       
    19     >>> mkdir('test')
       
    20     >>> cd('test')
       
    21     >>> write('setup.py',
       
    22     ... '''
       
    23     ... from distutils.core import setup
       
    24     ... setup(name='sample')
       
    25     ... ''')
       
    26 
       
    27 We've created a super simple (stupid) setup script.  Note that it
       
    28 doesn't import setuptools.  Let's try running it to create an egg.
       
    29 We'll use the buildout script from our sample buildout:
       
    30 
       
    31     >>> print system(buildout+' setup'),
       
    32     ... # doctest: +NORMALIZE_WHITESPACE
       
    33     Error: The setup command requires the path to a setup script or
       
    34     directory containing a setup script, and its arguments.
       
    35 
       
    36 Oops, we forgot to give the name of the setup script:
       
    37 
       
    38     >>> print system(buildout+' setup setup.py bdist_egg'),
       
    39     ... # doctest: +ELLIPSIS
       
    40     Running setup script 'setup.py'.
       
    41     ...
       
    42 
       
    43     >>> ls('dist')
       
    44     -  sample-0.0.0-py2.5.egg
       
    45 
       
    46 Note that we can specify a directory name.  This is often shorter and
       
    47 preferred by the lazy :)
       
    48 
       
    49     >>> print system(buildout+' setup . bdist_egg'), # doctest: +ELLIPSIS
       
    50     Running setup script './setup.py'.
       
    51     ...