def call_setup(path, a): ''' Call the `setup.py` file under the specified path with the given arguments. Note that `path` must be the directory in which the setup file is located, not the direct path to the file. For example, `/home/user/packages/pyg-0.7/' is right (assuming there is a `setup.py` file in it), while '/home/user/packages/pyg-0.7/setup.py` is not. ''' code = SETUP_PY_TEMPLATE.format(os.path.join(path, 'setup.py')) args = [sys.executable, '-c', code] + a if under_virtualenv(): logger.debug('debug: virtualenv detected') headers = os.path.join(sys.prefix, 'include', 'site', 'python' + PYTHON_VERSION) args += ['--install-headers', headers] return call_subprocess(args, cwd=path)
def site_info(): '''Return some site information''' template = '''# Python version: {py_version!r} # Python version info: {py_version_info!r} # Python Prefix: {prefix!r} # Platform: {platform!r} # Pyg version: {pyg_version!r} # Inside a virtualenv: {in_env!r} ''' return template.format( py_version=sys.version, py_version_info='.'.join(str(v) for v in sys.version_info), platform=distutils.util.get_platform(), prefix=sys.prefix, pyg_version=__version__, in_env=under_virtualenv() )