本文整理汇总了Python中exit.err_exit函数的典型用法代码示例。如果您正苦于以下问题:Python err_exit函数的具体用法?Python err_exit怎么用?Python err_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了err_exit函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_sftp
def run_sftp(self, distfile, location):
if not self.process.quiet:
print 'running sftp_upload'
self.delay()
name = basename(distfile)
print 'Uploading dist/%(name)s to %(location)s' % locals()
with tempfile.NamedTemporaryFile() as file:
cmds = 'put "%(distfile)s"\nbye\n' % locals()
if sys.version_info[0] >= 3:
cmds = encode(cmds)
file.write(cmds)
file.flush()
cmdfile = file.name
try:
rc, lines = self.process.popen(
'sftp -b "%(cmdfile)s" "%(location)s"' % locals(),
echo=False)
if rc == 0:
if not self.process.quiet:
print 'OK'
return rc
except KeyboardInterrupt:
pass
err_exit('ERROR: sftp failed')
示例2: run_register
def run_register(self, dir, infoflags, location, ff='', quiet=False):
if not self.process.quiet:
print 'running register'
echo = After('running register')
if quiet:
echo = And(echo, Not(Equals(OK_RESPONSE)))
checkcmd = []
if 'check' in distutils.command.__all__:
checkcmd = ['check']
serverflags = ['--repository="%(location)s"' % locals()]
rc, lines = self._run_setup_py(
['egg_info'] + infoflags + checkcmd +
['register'] + serverflags,
echo=echo,
ff=ff)
if rc == 0:
if self._parse_register_results(lines):
if not self.process.quiet and quiet:
print 'OK'
return rc
err_exit('ERROR: register failed')
示例3: get_options
def get_options(self):
"""Process the command line.
"""
args = self.parse_options(self.args)
if args:
self.directory = args[0]
if self.list:
self.list_locations()
if not self.locations:
self.locations.extend(self.locations.get_default_location())
if not self.skipupload:
self.locations.check_valid_locations()
if len(args) > 1:
if self.urlparser.is_url(self.directory):
self.branch = args[1]
elif self.urlparser.is_ssh_url(self.directory):
self.branch = args[1]
else:
err_exit('mkrelease: too many arguments\n%s' % USAGE)
if len(args) > 2:
err_exit('mkrelease: too many arguments\n%s' % USAGE)
示例4: create_tag
def create_tag(self, dir, tagid, name, version, push):
url = self.get_url_from_sandbox(dir)
rc, lines = self.process.popen(
('svn copy -m"Tagged %(name)s %(version)s." "%(url)s" "%(tagid)s"' % locals()),
echo=tee.NotEmpty())
if rc != 0:
err_exit('Tag failed')
return rc
示例5: get_url_from_sandbox
def get_url_from_sandbox(self, dir):
rc, lines = self.process.popen(
'svn info "%(dir)s"' % locals(), echo=False)
if rc == 0 and lines:
if self.version_info[:2] >= (1, 7):
return lines[2][5:]
else:
return lines[1][5:]
err_exit('Failed to get URL from %(dir)s' % locals())
示例6: get_package_info
def get_package_info(self, dir, develop=False):
python = self.python
rc, lines = self.process.popen(
'"%(python)s" setup.py --name --version' % locals(), echo=False)
if rc == 0 and len(lines) == 2:
name, version = lines
if develop:
parser = ConfigParser(warn)
parser.read('setup.cfg')
version += parser.get('egg_info', 'tag_build', '').strip()
return name, pkg_resources.safe_version(version)
err_exit('Bad setup.py')