##// END OF EJS Templates
ENH: Docstrings for the user namespace API.
ENH: Docstrings for the user namespace API.

File last commit:

r1331:9992bddd
r1494:d89e51e9
Show More
platutils.py
47 lines | 1.5 KiB | text/x-python | PythonLexer
vivainio
Added platutils modules, now only needed for %cd to ...
r107 # -*- coding: utf-8 -*-
""" Proxy module for accessing platform specific utility functions.
Importing this module should give you the implementations that are correct
for your operation system, from platutils_PLATFORMNAME module.
"""
#*****************************************************************************
# Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#*****************************************************************************
from IPython import Release
__author__ = '%s <%s>' % Release.authors['Ville']
__license__ = Release.license
Fernando Perez
Refactor of platutils for cleanup....
r1331 import os
import sys
vivainio
Added platutils modules, now only needed for %cd to ...
r107
Fernando Perez
Refactor of platutils for cleanup....
r1331 # Import the platform-specific implementations
vivainio
Added platutils modules, now only needed for %cd to ...
r107 if os.name == 'posix':
Fernando Perez
Refactor of platutils for cleanup....
r1331 import platutils_posix as _platutils
vivainio
Corrected platform recognition for win32
r115 elif sys.platform == 'win32':
Fernando Perez
Refactor of platutils for cleanup....
r1331 import platutils_win32 as _platutils
vivainio
Added platutils modules, now only needed for %cd to ...
r107 else:
Fernando Perez
Refactor of platutils for cleanup....
r1331 import platutils_dummy as _platutils
vivainio
Added platutils modules, now only needed for %cd to ...
r107 import warnings
warnings.warn("Platutils not available for platform '%s', some features may be missing" %
os.name)
del warnings
Fernando Perez
Refactor of platutils for cleanup....
r1331
# Functionality that's logically common to all platforms goes here, each
# platform-specific module only provides the bits that are OS-dependent.
def freeze_term_title():
_platutils.ignore_termtitle = True
def set_term_title(title):
"""Set terminal title using the necessary platform-dependent calls."""
if _platutils.ignore_termtitle:
return
_platutils.set_term_title(title)