All Samples(2932) | Call(2682) | Derive(0) | Import(250)
Run command with arguments. Wait for command to complete, then return the returncode attribute. The arguments are the same as for the Popen constructor. Example: retcode = call(["ls", "-l"])
def call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete, then
return the returncode attribute.
The arguments are the same as for the Popen constructor. Example:
retcode = call(["ls", "-l"])
"""
return Popen(*popenargs, **kwargs).wait()
from datetime import datetime from os import mkdir from os.path import basename, join from subprocess import call, PIPE, CalledProcessError from sys import getrefcount # Import from itools
mkdir(path)
# Init
command = ['git', 'init', '-q']
call(command, cwd=path, stdout=PIPE)
# Add
command = ['git', 'add', '.']
error = call(command, cwd=path, stdout=PIPE, stderr=PIPE)
# Commit
if error == 0:
command = ['git', 'commit', '-q', '-m', 'Initial commit']
call(command, cwd=path, stdout=PIPE)
src/g/e/genomedata-1.2.2/install.py genomedata(Download)
from shutil import rmtree from site import addsitedir from string import Template from subprocess import call, PIPE, Popen from tempfile import mkdtemp from urllib import urlretrieve
os.chdir(dest)
return 0
else:
return call(str(command), executable=shell, shell=True,
env=self.env, cwd=os.getcwd())
def run_script(self, script, verbose=False):
" current path.") % self.pkg_name
print >>sys.stderr, ">> %s" % " ".join(cmd)
code = call(cmd, stdout=None, stderr=None)
if code != 0:
print >>sys.stderr, "Error occured installing %s" % self.name
src/s/e/segtools-1.1.2/install.py segtools(Download)
from shutil import rmtree from site import addsitedir from string import Template from subprocess import call, PIPE, Popen from tempfile import mkdtemp from urllib import urlretrieve
os.chdir(dest)
return 0
else:
return call(str(command), executable=shell, shell=True,
env=self.env, cwd=os.getcwd())
def run_script(self, script, verbose=False):
" current path.") % self.pkg_name
print >>sys.stderr, ">> %s" % " ".join(cmd)
code = call(cmd, stdout=None, stderr=None)
if code != 0:
print >>sys.stderr, "Error occured installing %s" % self.name
src/p/y/pycue-HEAD/split.py pycue(Download)
#!/usr/bin/env python # vim: set fileencoding=utf-8 : import os from glob import glob from subprocess import Popen, PIPE, call
infomsg( "calculating replaygain info...")
code = call( command, shell=False, stdin=PIPE, stdout=PIPE)
src/p/y/PyBayes-HEAD/examples/install_test_stress.py PyBayes(Download)
import os import shutil from string import join from subprocess import call, check_call def parse_options():
def run_tests(options):
run_tests = os.path.join(options.pybayes_dir, 'examples', 'run_tests.py')
args = [run_tests]
print(join(args, ' '))
call(args)
def run_stresses(options):
run_tests = os.path.join(options.pybayes_dir, 'examples', 'run_stresses.py')
args = [run_tests, '-d', options.data_dir]
print(join(args, ' '))
call(args)
src/p/a/pacha-0.2.3/pacha/hg.py pacha(Download)
"""Plugs into Mercurial and matches Pacha's need to commit, push, clone and other commands. """ import logging from subprocess import call, PIPE from getpass import getuser import os
def push(self):
"""Pushes the repository to the centralized Pacha Master server
The Mercurial API is broken here, it does not recognize 'default'
or 'default-push' in .hg/hgrc so we need to call it via
subprocess.call"""
command = "hg push"
call(command, shell=True, stdout=PIPE, stderr=PIPE)
src/c/2/c2c.recipe.jarfile-0.4.2/c2c/recipe/jarfile/buildout.py c2c.recipe.jarfile(Download)
# -*- coding: utf-8 -*- import os import shutil import tempfile from glob import glob from subprocess import call, STDOUT
cmd = "jar uf %(jarfile)s %(inputfiles)s"%args
errors = tempfile.TemporaryFile()
retcode = call(cmd.split(), cwd=self.basedir, stdout=errors, stderr=STDOUT)
if retcode != 0:
errors.seek(0)
src/p/y/PyFlickr-HEAD/examples/desktop_auth.py PyFlickr(Download)
from subprocess import call
import flickr
api = flickr.Flickr()
link = api.build_desktop_auth_link('read')
print 'link:', link
call(['open', link])
src/p/y/python-dev-utils-HEAD/mysql-ramdisk.py python-dev-utils(Download)
import os import sys from optparse import OptionGroup, OptionParser from subprocess import Popen, PIPE, call import settings
def disable_apparmor():
if is_linux():
call(['sudo aa-complain mysqld'], shell=True)
def calc_ramdisk_size(num_megabytes):
return num_megabytes * 1048576 / 512 # MB * MiB/KB;
def create_ramdisk(ramdisk_size, disk_path=settings.RAMDISK_PATH):
print 'Creating ramdisk...'
if is_linux():
size_in_mb = ramdisk_size * 512 / 1048576
# TODO: What if dir already exists? Destroy data?
call(['sudo mkdir -p %s' % disk_path], shell=True)
call(['sudo mount -t tmpfs -o size=%sM tmpfs %s' % (size_in_mb, disk_path)],
print "Unmounting ramdisk '%s'." % path_to_ramdisk
# Nonzero return codes are bad. Wouldn't want to accidently remove rm anything
# other than the ramdisk.
if call(['sudo umount %s' % path_to_ramdisk], shell=True):
raise Exception("Unmounting of ramdisk at '%s' failed." \
% path_to_ramdisk)
print "Deleting ramdisk '%s'." % path_to_ramdisk
call(['sudo rm -rf %s' % path_to_ramdisk], shell=True)
def install_db(path_to_ramdisk=None):
# TODO support other dbs?
print 'Installing new db...'
if is_linux():
call(['/usr/bin/mysql_install_db '
'--user=mysql '
'--basedir=/usr '
'--datadir=%s' % path_to_ramdisk], shell=True)
call(['sudo chmod 777 -R %s' % path_to_ramdisk], shell=True)
def start_db(path_to_ramdisk=None):
# TODO support other dbs?
# TODO make it more configurable?
print 'Starting db...'
if is_linux():
call(['sudo mysqld '
'--basedir=/usr '
src/f/i/firebird-HEAD/qa/trunk/benchmark/fbenchrun.py firebird(Download)
from fbench import * from optparse import OptionParser from configobj import ConfigObj from subprocess import check_call, call from imp import find_module, load_module import csv import traceback
def __call(self,arglist,log=None):
if log is not None:
call(arglist,stdout=self.log,stderr=self.log)
self.log.flush()
else:
call(arglist)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next