Package qm :: Module platform
[hide private]
[frames] | no frames]

Source Code for Module qm.platform

 1  ######################################################################## 
 2  # 
 3  # File:   platform.py 
 4  # Author: Alex Samuel 
 5  # Date:   2001-04-30 
 6  # 
 7  # Contents: 
 8  #   Platform-specific code. 
 9  # 
10  # Copyright (c) 2001, 2002 by CodeSourcery, LLC.  All rights reserved.  
11  # 
12  # For license terms see the file COPYING. 
13  # 
14  ######################################################################## 
15   
16  ######################################################################## 
17  # imports 
18  ######################################################################## 
19   
20  import common 
21  import os 
22  import qm 
23  import string 
24  import sys 
25   
26  ######################################################################## 
27  # classes 
28  ######################################################################## 
29   
30 -class MailError(common.QMException):
31 32 pass
33 34 35 ######################################################################## 36 # initialization 37 ######################################################################## 38 39 if sys.platform == "win32": 40 from platform_win32 import * 41 else: 42 from platform_unix import * 43 44 ######################################################################## 45 # functions 46 ######################################################################## 47
48 -def get_shell_for_command():
49 """Return the command shell to use when running a single shell command. 50 51 returns -- A sequence of argument list entries to use when invoking 52 the shell. The first element of the list is the shell executable 53 path. The command should be appended to the argument list.""" 54 55 shell = common.rc.Get("command_shell", None, "common") 56 if shell is not None: 57 # Split the configuration value into an argument list. 58 return common.split_argument_list(shell) 59 else: 60 if sys.platform == "win32": 61 shell = default_shell + ["/c"] 62 else: 63 shell = default_shell + ["-c"] 64 return shell
65 66
67 -def get_shell_for_script():
68 """Return the command shell to use when running a shell script. 69 70 returns -- A sequence of argument list entries to use when running a 71 shell script. The first element of the list is the shell 72 executable. The name of the script should be appended to the 73 argument list.""" 74 75 shell = common.rc.Get("script_shell", None, "common") 76 if shell is not None: 77 # Split the configuration value into an argument list. 78 return common.split_argument_list(shell) 79 else: 80 # On Windows, add the "/c" switch; that is needed even when 81 # invoking a script. 82 if sys.platform == "win32": 83 shell = default_shell + ["/c"] 84 else: 85 # Use the default, but copy it so the caller can change it. 86 shell = default_shell[:] 87 return shell
88 89 90 ######################################################################## 91 # Local Variables: 92 # mode: python 93 # indent-tabs-mode: nil 94 # fill-column: 72 95 # End: 96