##// END OF EJS Templates
Avoid justifying of 'in' prompt...
Avoid justifying of 'in' prompt This little diff is to avoid rjustify of the 'in' prompt, because in configurations with variable prompt size (e.g. my pysh prompt showing \w), going to a smaller prompt cause only-reversed-by-restart blank spaces addition in beggining of 'in' prompt. Right justify is ok to 'in2' and 'out' prompts, but very ugly and weird in 'in' prompt.

File last commit:

r5731:a1ccd554
r5804:21ba8f53
Show More
toollib.py
57 lines | 1.5 KiB | text/x-python | PythonLexer
"""Various utilities common to IPython release and maintenance tools.
"""
from __future__ import print_function
# Library imports
import os
import sys
from distutils.dir_util import remove_tree
# Useful shorthands
pjoin = os.path.join
cd = os.chdir
# Constants
# SSH root address of the archive site
archive_user = 'ipython@archive.ipython.org'
archive_dir = 'archive.ipython.org'
archive = '%s:%s' % (archive_user, archive_dir)
# Utility functions
def sh(cmd):
"""Run system command in shell, raise SystemExit if it returns an error."""
print("$", cmd)
stat = os.system(cmd)
#stat = 0 # Uncomment this and comment previous to run in debug mode
if stat:
raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
# Backwards compatibility
c = sh
def get_ipdir():
"""Get IPython directory from command line, or assume it's the one above."""
# Initialize arguments and check location
try:
ipdir = sys.argv[1]
except IndexError:
ipdir = '..'
ipdir = os.path.abspath(ipdir)
cd(ipdir)
if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
raise SystemExit('Invalid ipython directory: %s' % ipdir)
return ipdir
def compile_tree():
"""Compile all Python files below current directory."""
stat = os.system('python -m compileall .')
if stat:
msg = '*** ERROR: Some Python files in tree do NOT compile! ***\n'
msg += 'See messages above for the actual file that produced it.\n'
raise SystemExit(msg)