##// END OF EJS Templates
don't move old config files, keep nagging the user
don't move old config files, keep nagging the user

File last commit:

r3197:4050155b
r4201:24d6c364
Show More
toollib.py
48 lines | 1.3 KiB | text/x-python | PythonLexer
Fernando Perez
Cleaned up release tools directory....
r2118 """Various utilities common to IPython release and maintenance tools.
"""
# Library imports
import os
import sys
from distutils.dir_util import remove_tree
# Useful shorthands
pjoin = os.path.join
cd = os.chdir
# Utility functions
Fernando Perez
Clean up version info tools and remove bzr references.
r3197 def sh(cmd):
"""Run system command in shell, raise SystemExit if it returns an error."""
Fernando Perez
Cleaned up release tools directory....
r2118 print "$",cmd
Fernando Perez
Continue tool cleanup....
r2119 stat = os.system(cmd)
#stat = 0 # Uncomment this and comment previous to run in debug mode
Fernando Perez
Cleaned up release tools directory....
r2118 if stat:
raise SystemExit("Command %s failed with code: %s" % (cmd, stat))
Fernando Perez
Clean up version info tools and remove bzr references.
r3197 # Backwards compatibility
c = sh
Fernando Perez
Cleaned up release tools directory....
r2118
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."""
Fernando Perez
Clean up version info tools and remove bzr references.
r3197 stat = os.system('python -m compileall .')
Fernando Perez
Cleaned up release tools directory....
r2118 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)