/usr/bin/dh_virtualenv is in dh-virtualenv 0.6-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | #! /usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Spotify AB
# This file is part of dh-virtualenv.
# dh-virtualenv is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of the
# License, or (at your option) any later version.
# dh-virtualenv is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with dh-virtualenv. If not, see
# <http://www.gnu.org/licenses/>.
import inspect
import logging
import os
import sys
from optparse import OptionParser, SUPPRESS_HELP
# The debpython resides here
sys.path.insert(1, '/usr/share/python/')
from debpython.debhelper import DebHelper
from dh_virtualenv import Deployment
logging.basicConfig(format='%(levelname).1s: %(module)s:%(lineno)d: '
'%(message)s')
log = logging.getLogger(__name__)
def main():
usage = '%prog [options]'
parser = OptionParser(usage, version='%prog 0.1')
parser.add_option('-p', '--package', action='append',
help='act on the package named PACKAGE')
parser.add_option('-N', '--no-package', action='append',
help='do not act on the specified package')
parser.add_option('-v', '--verbose', action='store_true',
default=False, help='Turn on verbose mode')
parser.add_option('-s', '--setuptools', action='store_true',
default=False, help='Use Setuptools instead of Distribute')
parser.add_option('--extra-index-url', action='append',
help='extra index URL to pass to pip.',
default=[])
parser.add_option('--preinstall', action='append',
help=('package to install before processing '
'requirements.txt.'),
default=[])
parser.add_option('--pypi-url', help='Base URL of the PyPI server')
# Ignore user-specified option bunldes
parser.add_option('-O', help=SUPPRESS_HELP)
options, args = parser.parse_args(
sys.argv[1:] + os.environ.get('DH_OPTIONS', '').split())
verbose = options.verbose or os.environ.get('DH_VERBOSE') == '1'
if verbose:
log.setLevel(logging.DEBUG)
# Older DebHelpers, like the one on Debian Squeeze, expect to be
# passed the packages keyword argument. Newer (like Ubuntu
# Precise) expect the whole optoins to be passed.
arguments = inspect.getargspec(DebHelper.__init__).args
if 'packages' in arguments:
dh = DebHelper(packages=options.package or None)
else:
dh = DebHelper(options)
for package, details in dh.packages.items():
def _info(msg):
log.info('{0}: {1}'.format(package, msg))
_info('Processing package...')
deploy = Deployment(
package,
extra_urls=options.extra_index_url,
preinstall=options.preinstall,
pypi_url=options.pypi_url,
setuptools=options.setuptools,
verbose=verbose,
)
_info('Creating virtualenv')
deploy.create_virtualenv()
deploy.install_dependencies()
deploy.install_package()
deploy.fix_shebangs()
if __name__ == '__main__':
sys.exit(main() or 0)
|