Esempio n. 1
0
def set_windows_env_variables(config):
    import winpaths
    config.set('DEFAULT', 'common_app_data_folder',
               winpaths.get_common_appdata())
    config.set('DEFAULT', 'win_local_appdata', winpaths.get_local_appdata())
    config.set('DEFAULT', 'win_appdata', winpaths.get_appdata())
    config.set('DEFAULT', 'win_desktop', winpaths.get_desktop())
    config.set('DEFAULT', 'win_programs', winpaths.get_programs())
    config.set('DEFAULT', 'win_common_admin_tools',
               winpaths.get_common_admin_tools())
    config.set('DEFAULT', 'win_common_documents',
               winpaths.get_common_documents())
    config.set('DEFAULT', 'win_cookies', winpaths.get_cookies())
    config.set('DEFAULT', 'win_history', winpaths.get_history())
    config.set('DEFAULT', 'win_internet_cache', winpaths.get_internet_cache())
    config.set('DEFAULT', 'win_my_pictures', winpaths.get_my_pictures())
    config.set('DEFAULT', 'win_personal', winpaths.get_personal())
    config.set('DEFAULT', 'win_my_documents', winpaths.get_my_documents())
    config.set('DEFAULT', 'win_program_files', winpaths.get_program_files())
    config.set('DEFAULT', 'win_program_files_common',
               winpaths.get_program_files_common())
    config.set('DEFAULT', 'win_system', winpaths.get_system())
    config.set('DEFAULT', 'win_windows', winpaths.get_windows())
    config.set('DEFAULT', 'win_startup', winpaths.get_startup())
    config.set('DEFAULT', 'win_recent', winpaths.get_recent())
Esempio n. 2
0
def getHomeDir():
    if sys.platform == 'win32':
        import winpaths
        homedir = winpaths.get_common_appdata() # = e.g 'C:\ProgramData'
    else:
        homedir = os.path.expanduser("~")
    return homedir
Esempio n. 3
0
 def dataDir(cls):
     """ get data file directory """
     if platform == 'win32':        
         import winpaths
         path = winpaths.get_common_appdata()
         path = os.path.join(path, 'mySync')
         if not os.path.isdir(path): os.mkdir(path)
     elif platform == 'darwin':
         user_path = os.path.expanduser('~') 
         path = os.path.join(user_path, 'Library')
         if not os.path.isdir(path): os.mkdir(path)
         path = os.path.join(path, 'Application Support')
         if not os.path.isdir(path): os.mkdir(path)
         path = os.path.join(path, 'mySync')
         if not os.path.isdir(path): os.mkdir(path)
     else:
         path = cls.curFileDir()
     return path
Esempio n. 4
0
 def dataDir(cls):
     """ get data file directory """
     if platform == 'win32':
         import winpaths
         path = winpaths.get_common_appdata()
         path = os.path.join(path, 'mySync')
         if not os.path.isdir(path): os.mkdir(path)
     elif platform == 'darwin':
         user_path = os.path.expanduser('~')
         path = os.path.join(user_path, 'Library')
         if not os.path.isdir(path): os.mkdir(path)
         path = os.path.join(path, 'Application Support')
         if not os.path.isdir(path): os.mkdir(path)
         path = os.path.join(path, 'mySync')
         if not os.path.isdir(path): os.mkdir(path)
     else:
         path = cls.curFileDir()
     return path
Esempio n. 5
0
def set_windows_env_variables(config):
    import winpaths
    config.set('DEFAULT', 'common_app_data_folder', winpaths.get_common_appdata())
    config.set('DEFAULT', 'win_local_appdata', winpaths.get_local_appdata())
    config.set('DEFAULT', 'win_appdata', winpaths.get_appdata())
    config.set('DEFAULT', 'win_desktop', winpaths.get_desktop())
    config.set('DEFAULT', 'win_programs', winpaths.get_programs())
    config.set('DEFAULT', 'win_common_admin_tools', winpaths.get_common_admin_tools())
    config.set('DEFAULT', 'win_common_documents', winpaths.get_common_documents())
    config.set('DEFAULT', 'win_cookies', winpaths.get_cookies())
    config.set('DEFAULT', 'win_history', winpaths.get_history())
    config.set('DEFAULT', 'win_internet_cache', winpaths.get_internet_cache())
    config.set('DEFAULT', 'win_my_pictures', winpaths.get_my_pictures())
    config.set('DEFAULT', 'win_personal', winpaths.get_personal())
    config.set('DEFAULT', 'win_my_documents', winpaths.get_my_documents())
    config.set('DEFAULT', 'win_program_files', winpaths.get_program_files())
    config.set('DEFAULT', 'win_program_files_common', winpaths.get_program_files_common())
    config.set('DEFAULT', 'win_system', winpaths.get_system())
    config.set('DEFAULT', 'win_windows', winpaths.get_windows())
    config.set('DEFAULT', 'win_startup', winpaths.get_startup())
    config.set('DEFAULT', 'win_recent', winpaths.get_recent())
Esempio n. 6
0
import os.path
import sys
from sys import platform

def cur_file_dir():
    sys_path = sys.path[0]
    if os.path.isdir(sys_path):
        return sys_path
    elif os.path.isfile(sys_path):
        return os.path.dirname(sys_path)

if platform == 'win32':        
    import winpaths
    path = winpaths.get_common_appdata()
    path = os.path.join(path, 'mySync')
    if not os.path.isdir(path): os.mkdir(path)
elif platform == 'darwin':
    user_path = os.path.expanduser('~') 
    path = os.path.join(user_path, 'Library')
    if not os.path.isdir(path): os.mkdir(path)
    path = os.path.join(path, 'Application Support')
    if not os.path.isdir(path): os.mkdir(path)
    path = os.path.join(path, 'mySync')
    if not os.path.isdir(path): os.mkdir(path)
else:
    path = cur_file_dir()

LOG_PATH = path
DATA_PATH = os.path.join(path, 'data')
AUTH_PATH = os.path.join(path, 'auth')
Esempio n. 7
0
        cfg_parcer = ConfigParser()
        cfg_parcer.read(sprv_cfg_path)
        try:
            cfg_path, cfg_file_ext = os.path.split(cfg_parcer.get('include',
                                                                  'files'))
        except (NoSectionError, NoOptionError) as err:
            msg = ('ERROR:The Supervisord application is not installed or '
                   'not configured properly. Configuration file {path} '
                   'does not contain section - "include" or option - '
                   '"files".\nError message is - {msg}.\nAll locust '
                   'service functionality are working wrong.\n')
            sys.stderr.write(msg.format(path=sprv_cfg_path, msg=err.message))
            return None, None

        cfg_path = os.path.join(os.path.dirname(sprv_cfg_path), cfg_path)
        return cfg_path, os.path.splitext(cfg_file_ext)[1]

    SUPERVISORD_CONF_PATH, SUPERVISORD_CONF_EXT = get_supeprvisord_conf_path()

    MODULE_CFG_PATH = '/etc/locust/'

    LOG_PATH = LOG_OUT_PATH = LOG_ERR_PATH ='/var/log/{name}'
elif IS_WINDOWS:
    # pylint: disable=F0401
    from winpaths import get_common_appdata
    MODULE_CFG_PATH = os.path.join(get_common_appdata(), 'locust')
    LOG_PATH = os.path.join(MODULE_CFG_PATH, '{name}')

CONFIG_STORAGE = ServiceConfig()
EXIT_CODE = 2