Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(59)  |  Call(42)  |  Derive(0)  |  Import(17)
Run a setup script in a somewhat controlled environment, and
return the Distribution instance that drives things.  This is useful
if you need to find out the distribution meta-data (passed as
keyword args from 'script' to 'setup()', or the contents of the
config files or command-line.

'script_name' is a file that will be run with 'execfile()';
'sys.argv[0]' will be replaced with 'script' for the duration of the
call.  'script_args' is a list of strings; if supplied,
'sys.argv[1:]' will be replaced by 'script_args' for the duration of(more...)

        def run_setup(script_name, script_args=None, stop_after="run"):
    """Run a setup script in a somewhat controlled environment, and
    return the Distribution instance that drives things.  This is useful
    if you need to find out the distribution meta-data (passed as
    keyword args from 'script' to 'setup()', or the contents of the
    config files or command-line.

    'script_name' is a file that will be run with 'execfile()';
    'sys.argv[0]' will be replaced with 'script' for the duration of the
    call.  'script_args' is a list of strings; if supplied,
    'sys.argv[1:]' will be replaced by 'script_args' for the duration of
    the call.

    'stop_after' tells 'setup()' when to stop processing; possible
    values:
      init
        stop after the Distribution instance has been created and
        populated with the keyword arguments to 'setup()'
      config
        stop after config files have been parsed (and their data
        stored in the Distribution instance)
      commandline
        stop after the command-line ('sys.argv[1:]' or 'script_args')
        have been parsed (and the data stored in the Distribution)
      run [default]
        stop after all commands have been run (the same as if 'setup()'
        had been called in the usual way

    Returns the Distribution instance, which provides all information
    used to drive the Distutils.
    """
    if stop_after not in ('init', 'config', 'commandline', 'run'):
        raise ValueError, "invalid value for 'stop_after': %r" % (stop_after,)

    global _setup_stop_after, _setup_distribution
    _setup_stop_after = stop_after

    save_argv = sys.argv
    g = {'__file__': script_name}
    l = {}
    try:
        try:
            sys.argv[0] = script_name
            if script_args is not None:
                sys.argv[1:] = script_args
            f = open(script_name)
            try:
                exec f.read() in g, l
            finally:
                f.close()
        finally:
            sys.argv = save_argv
            _setup_stop_after = None
    except SystemExit:
        # Hmm, should we do something if exiting with a non-zero code
        # (ie. error)?
        pass
    except:
        raise

    if _setup_distribution is None:
        raise RuntimeError, \
              ("'distutils.core.setup()' was never called -- "
               "perhaps '%s' is not a Distutils setup script?") % \
              script_name

    # I wonder if the setup script's namespace -- g and l -- would be of
    # any interest to callers?
    return _setup_distribution
        


src/l/o/logilab-devtools-0.22.2/lgp/setupinfo.py   logilab-devtools(Download)
import logging
from string import Template
from distutils.core import run_setup
#from pkg_resources import FileMetadata
from subprocess import Popen, PIPE
            if osp.basename(setup_file) == 'setup.py':
                # case for python project (distutils, setuptools)
                self.config._package = run_setup(setup_file, None,
                                                 stop_after="init")
            else:

src/f/w/fwrap-0.1.1/fwrap/main.py   fwrap(Download)
    help_fcompiler = kargs.get('help_fcompiler')
    if help_fcompiler:
        from distutils.core import run_setup
        run_setup(file_name, script_args=make_scriptargs(kargs))
        return
        os.chdir(project_path)
        logger.info("Changing to project directory %s" % project_path)
        from distutils.core import run_setup
        run_setup(file_name, script_args=make_scriptargs(kargs))
    finally:

src/w/o/woven-0.8/woven/environment.py   woven(Download)
#!/usr/bin/env python
import json, os, string, sys, tempfile
from contextlib import nested
from distutils.core import run_setup
 
    os.chdir(local_working_dir)
 
    setup = run_setup('setup.py',stop_after="init")
 
    if setup.get_name() == 'UNKNOWN' or setup.get_version()=='0.0.0' or not setup.packages:

src/w/o/woven-0.8/bin/woven-admin.py   woven(Download)
#!/usr/bin/env python
import sys, os
from distutils.core import run_setup
from random import choice
import re
            os.chdir(local_working_dir)
 
        setup = run_setup('setup.py',stop_after="init")
        settings_mod = '.'.join([setup.packages[0],'settings'])
        os.environ['DJANGO_SETTINGS_MODULE'] =  settings_mod

src/w/o/woven-HEAD/woven/environment.py   woven(Download)
#!/usr/bin/env python
import json, os, string, sys, tempfile
from contextlib import nested
from distutils.core import run_setup
 
    os.chdir(local_working_dir)
 
    setup = run_setup('setup.py',stop_after="init")
 
    if setup.get_name() == 'UNKNOWN' or setup.get_version()=='0.0.0' or not setup.packages:

src/w/o/woven-HEAD/bin/woven-admin.py   woven(Download)
#!/usr/bin/env python
import sys, os
from distutils.core import run_setup
from random import choice
import re
 
        woven_admin = sys.argv[0]
        setup = run_setup('setup.py',stop_after="init")
        settings_mod = '.'.join([setup.packages[0],'settings'])
        os.environ['DJANGO_SETTINGS_MODULE'] =  settings_mod

src/i/i/iiswsgi-0.3/iiswsgi/bdist_webpi.py   iiswsgi(Download)
            if os.path.abspath(path) != os.path.abspath(cwd):
                distribution = core.run_setup(
                    'setup.py', stop_after='commandline')
 
            distribution.build = distribution.get_command_obj('build')
    def write_feed(self, dist_file, **kw):
        logger.info('Writing Web Platform Installer feed to {0}'.format(
            dist_file))
 
        view = core.run_setup('setup.py', stop_after='commandline')

src/s/e/seed-0.3.4/seed/commands/__init__.py   seed(Download)
import optparse
import sys
import difflib
import os
from distutils.core import run_setup
 
        try:
            distribution = run_setup(setup_path, stop_after="init")
        except Exception, e:
            print "Warning: failed to load distribution information from setup.py. Error was: %s" % e

src/i/i/iiswsgi-HEAD/iiswsgi/bdist_webpi.py   iiswsgi(Download)
            if os.path.abspath(path) != os.path.abspath(cwd):
                distribution = core.run_setup(
                    'setup.py', stop_after='commandline')
 
            distribution.build = distribution.get_command_obj('build')
    def write_feed(self, dist_file, **kw):
        logger.info('Writing Web Platform Installer feed to {0}'.format(
            dist_file))
 
        view = core.run_setup('setup.py', stop_after='commandline')

src/s/e/seed-HEAD/seed/commands/__init__.py   seed(Download)
import optparse
import sys
import difflib
import os
from distutils.core import run_setup
 
        try:
            distribution = run_setup(setup_path, stop_after="init")
        except Exception, e:
            print "Warning: failed to load distribution information from setup.py. Error was: %s" % e

  1 | 2 | 3 | 4  Next