def create_cache_dir(): """Create the top-level bzr-svn cache directory. :return: Path to cache directory, as byte string. """ ensure_config_dir_exists() if version_info[3] == 'exp': name = 'svn-cache-exp' else: name = 'svn-cache' if sys.platform in ("nt", "win32"): from breezy.win32utils import get_local_appdata_location base_cache_dir = get_local_appdata_location() assert base_cache_dir is not None cache_dir = os.path.join(base_cache_dir, name) else: base_cache_dir = config_dir() cache_dir = os.path.join(base_cache_dir, name) # Check and use old location if possible if not os.path.exists(cache_dir): try: from xdg.BaseDirectory import xdg_cache_home except ImportError: pass else: cache_dir = os.path.join(xdg_cache_home, "bazaar", "svn") if not os.path.exists(cache_dir): os.makedirs(cache_dir) write_cache_readme(os.path.join(cache_dir, "README")) return cache_dir
def get_sys_info(): """Get the system information. :return: a dictionary mapping fields to values. Field names are: * bzr-version - version of Bazaar * bzr-lib-path - paths to breezy roots (a list) * bzr-source-tree - source tree holding Bazaar (None or a Tree object) * bzr-config-dir - configuration directory holding bazaar.conf, etc. * bzr-log-file - path to bzr.log file * python-file - path to Python interpreter * python-version - version of Python interpreter * python-lib-dir - path to Python standard library """ result = {} # Bazaar installation result["bzr-version"] = breezy.__version__ result["bzr-lib-path"] = breezy.__path__ # is breezy itself in a branch? source_tree = None # _get_bzr_source_tree() if source_tree: result["bzr-source-tree"] = _source_tree_details() else: result["bzr-source-tree"] = None # Bazaar configuration # config_dir = os.path.normpath(config.config_dir()) # use native slashes config_dir = osutils.normpath(bedding.config_dir()) if not isinstance(config_dir, str): config_dir = config_dir.decode(osutils.get_user_encoding()) result["brz-config-dir"] = config_dir result["brz-log-file"] = trace._brz_log_filename # Python installation # (bzr.exe use python interpreter from pythonXY.dll # but sys.executable point to bzr.exe itself) if not hasattr(sys, 'frozen'): # check for bzr.exe # python executable py_file = sys.executable else: # pythonXY.dll basedir = os.path.dirname(sys.executable) python_dll = "python%d%d.dll" % sys.version_info[:2] py_file = os.path.join(basedir, python_dll) result["python-file"] = py_file result["python-version"] = breezy._format_version_tuple(sys.version_info) result["python-lib-dir"] = os.path.dirname(os.__file__) return result
def config_filename(): return osutils.pathjoin(bedding.config_dir(), 'qbrz.conf')
def get_user_plugin_path(): from breezy.bedding import config_dir return osutils.pathjoin(config_dir(), 'plugins')
def __init__(self, possible_transports=None): t = transport.get_transport_from_path( config_dir(), possible_transports=possible_transports) super(SubversionStore, self).__init__(t, 'subversion.conf') self.id = 'subversion'
def _get_filename(self): return osutils.pathjoin(config_dir(), 'subversion.conf')