本文整理汇总了Python中jarn.mkrelease.process.Process类的典型用法代码示例。如果您正苦于以下问题:Python Process类的具体用法?Python Process怎么用?Python Process使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Process类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_env
def test_env(self):
env = os.environ.copy()
env['HELLO'] = 'Hello world'
process = Process(quiet=True, env=env)
rc, lines = process.popen('echo ${HELLO}')
self.assertEqual(rc, 0)
self.assertEqual(lines, ['Hello world'])
示例2: setUp
def setUp(self):
SubversionSetup.setUp(self)
process = Process(quiet=True)
process.system('svn mv -m"Rename" "file://%s/tags" "file://%s/tag"' %
(self.packagedir, self.packagedir))
process.system('svn mv -m"Rename" "file://%s/branches" "file://%s/branch"' %
(self.packagedir, self.packagedir))
示例3: checkout
def checkout(self, path='trunk', target=None):
process = Process(quiet=True)
if target is None:
self.checkoutdir = join(self.tempdir, self.packagename)
else:
self.checkoutdir = join(self.tempdir, target, self.packagename)
process.system('svn checkout file://%s/%s %s' % (self.repo,
path, self.checkoutdir))
os.chdir(self.checkoutdir)
示例4: clone
def clone(self):
process = Process(quiet=True)
process.system('git clone testpackage testclone')
self.clonedir = join(self.tempdir, 'testclone')
# Park the server on a branch because "Updating the currently
# checked-out branch may cause confusion."
self.dirstack.push('testpackage')
process.system('git checkout -b parking')
self.dirstack.pop()
示例5: _fake_clone
def _fake_clone(self):
# Fake a checkout, the real thing is too expensive
process = Process(quiet=True)
source = self._fake_source
package = join(dirname(__file__), 'tests', source)
archive = zipfile.ZipFile(package, 'r')
archive.extractall()
os.rename(source[:-4], 'testclone')
self.dirstack.push('testclone')
if self.scm.version_info[:2] >= (1, 7):
url = process.popen('svn info')[1][2][5:]
else:
url = process.popen('svn info')[1][1][5:]
process.system('svn switch --relocate %s file://%s/trunk' % (url, self.packagedir))
self.dirstack.pop()
self.clonedir = join(self.tempdir, 'testclone')
示例6: testGetGitifySubversion
def testGetGitifySubversion(self):
"""
Support git-svn-helpers/gitify style dual git/svn checkouts/clones.
"""
# Simulate a git-svn-helpers/gitify style dual svn/git checkout/clone
svn_url = urlparse.urlunsplit(('file', '', self.packagedir, '', ''))
git_svn_clonedir = self.clonedir + '.git-svn'
process = Process(quiet=True)
process.system(
'git svn clone -s {0} {1}'.format(svn_url, git_svn_clonedir))
os.rename(
os.path.join(git_svn_clonedir, '.git'),
os.path.join(self.clonedir, '.git'))
scms = SCMFactory()
self.assertEqual(scms.get_scm_from_url(svn_url).name, 'svn')
self.assertEqual(scms.get_scm_from_sandbox(self.clonedir).name, 'svn')
示例7: testAmbiguousSandbox
def testAmbiguousSandbox(self):
scms = SCMFactory()
process = Process()
self.dirstack.push(self.packagedir)
process.system('hg init .')
process.system('hg add README.txt setup.py testpackage/__init__.py')
process.system('hg commit -m"Import"')
self.dirstack.pop()
self.assertRaises(SystemExit, scms.get_scm, None, self.packagedir)
示例8: clone
def clone(self):
process = Process(quiet=True)
process.system('git clone testpackage testclone')
self.clonedir = join(self.tempdir, 'testclone')
# Park the server on a branch
self.dirstack.push('testpackage')
process.system('git checkout parking')
self.dirstack.pop()
# Make sure the clone is on master
self.dirstack.push('testclone')
process.system('git checkout master')
self.dirstack.pop()
示例9: testUpdateWithRevisionPin
def testUpdateWithRevisionPin(self):
from mr.developer.develop import CmdCheckout
from mr.developer.develop import CmdUpdate
process = Process()
repository = os.path.join(self.tempdir, 'repository')
rc, lines = process.popen(
"svnadmin create {0}".format(repository))
assert rc == 0
checkout = os.path.join(self.tempdir, 'checkout')
rc, lines = process.popen(
"svn checkout file://{0} {1}".format(repository, checkout),
echo=False)
assert rc == 0
foo = os.path.join(checkout, 'foo')
self.mkfile(foo, 'foo')
rc, lines = process.popen(
"svn add {0}".format(foo),
echo=False)
assert rc == 0
rc, lines = process.popen(
"svn commit {0} -m foo".format(foo),
echo=False)
assert rc == 0
bar = os.path.join(checkout, 'bar')
self.mkfile(bar, 'bar')
rc, lines = process.popen(
"svn add {0}".format(bar),
echo=False)
assert rc == 0
rc, lines = process.popen(
"svn commit {0} -m bar".format(bar),
echo=False)
assert rc == 0
src = os.path.join(self.tempdir, 'src')
develop = MockDevelop()
develop.sources = {
'egg': Source(
kind='svn',
name='egg',
url='file://{0}@1'.format(repository),
path=os.path.join(src, 'egg'))}
CmdCheckout(develop)(develop.parser.parse_args(['co', 'egg']))
assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.svn', 'foo'))
CmdUpdate(develop)(develop.parser.parse_args(['up', 'egg']))
assert set(os.listdir(os.path.join(src, 'egg'))) == set(('.svn', 'foo'))
示例10: remove
def remove(self, dir):
process = Process(quiet=True)
process.system('git rm setup.py')
示例11: test_quiet
def test_quiet(self):
process = Process(quiet=True)
value = process.pipe('echo "Hello world"')
self.assertEqual(value, 'Hello world')
示例12: branch
def branch(self, dir, branchid):
process = Process(quiet=True)
process.system('hg branch %s' % branchid)
示例13: tag
def tag(self, dir, tagid):
process = Process(quiet=True)
process.system('hg tag %s' % tagid)
process.system('hg update %s' % tagid)
示例14: update
def update(self, dir):
process = Process(quiet=True)
process.system('hg update')
示例15: test_bad_cmd
def test_bad_cmd(self):
process = Process()
rc = process.system('$ "Hello world" 2> output')
self.assertEqual(rc, 127)