Returns the :attr:`ProjectHome` relative to :attr:`FileName` directory.
774277
def ProjectHomeRelative(self):
        
        return os.path.relpath(self.ProjectHome, os.path.dirname(self.FileName))
901443
def folder_name(self):
        ''''''
        name = self.site_packages_name
        if name is None:
            name = self.name
        return name
944430
def _directory (self):
        """"""
        if self._filename is None:
            return os.path.join(self._ROOT_DIR, 'config')
        else:
            return os.path.dirname(self._filename)
94110
def filename(out_dir, name, undefine=False):
    """"""
    if undefine:
        prefix = 'undef_'
    else:
        prefix = ''
    return os.path.join(out_dir, '{0}{1}.hpp'.format(prefix, name.lower()))
1089487
def relative_to_contrib(diff, project):
    
    path = pathlib.Path(diff.b_path)
    contrib_path = project.contrib_module_path
    return path.relative_to(contrib_path)
515533
def get_project_name():
    
    setup_py_content = helpers.get_file_content('setup.py')
    ret = helpers.value_of_named_argument_in_function(
        'name', 'setup', setup_py_content, resolve_varname=True
    )
    if ret and ret[0] == ret[-1] in ('"', "'"):
        ret = ret[1:-1]
    return ret
714368
def project_map(self):
        """"""
        # first update with the experiments in the memory (the others should
        # already be loaded within the :attr:`exp_files` attribute)
        for key, val in self.items():
            if isinstance(val, dict):
                l = self._project_map[val['project']]
            elif isinstance(val, Archive):
                l = self._project_map[val.project]
            else:
                continue
            if key not in l:
                l.append(key)
        return self._project_map
1184766
def get_active_project_path(self):
        """"""
        active_project_path = None
        if self.current_active_project:
            active_project_path = self.current_active_project.root_path
        return active_project_path
1354692
def CompileFilesRelative(self):
        
        return (os.path.relpath(path, self.ProjectHome) for path in sorted(self.CompileFiles, key=self.lower))
353874
def get_project_files():
    
    if is_git_project():
        return get_git_project_files()

    project_files = []
    for top, subdirs, files in os.walk('.'):
        for subdir in subdirs:
            if subdir.startswith('.'):
                subdirs.remove(subdir)

        for f in files:
            if f.startswith('.'):
                continue
            project_files.append(os.path.join(top, f))

    return project_files
521536
def egg_name(self):
        """"""
        filename = "%s-%s-py%s" % (
            to_filename(self.project_name), to_filename(self.version),
            self.py_version or PY_MAJOR
        )

        if self.platform:
            filename += '-' + self.platform
        return filename
649182
def get_config_h_filename():
    """"""
    if _PYTHON_BUILD:
        if os.name == "nt":
            inc_dir = os.path.join(_PROJECT_BASE, "PC")
        else:
            inc_dir = _PROJECT_BASE
    else:
        inc_dir = get_path('platinclude')
    return os.path.join(inc_dir, 'pyconfig.h')
1309482
def dirpath(self):
        """"""
        if self.isfile():
            return Path(op.dirname(self._fspath))
        else:
            return Path(self)
929638
def get_project_root():
    """"""
    cfg = get_project_configuration()
    # At this point it can be sure that the configuration file exists
    # Now make sure the project structure exists
    for dirname in ["raw-datasets",
                    "preprocessed",
                    "feature-files",
                    "models",
                    "reports"]:
        directory = os.path.join(cfg['root'], dirname)
        if not os.path.exists(directory):
            os.makedirs(directory)

    raw_yml_path = pkg_resources.resource_filename('hwrt', 'misc/')

    # TODO: How to check for updates if it already exists?
    raw_data_dst = os.path.join(cfg['root'], "raw-datasets/info.yml")
    if not os.path.isfile(raw_data_dst):
        raw_yml_pkg_src = os.path.join(raw_yml_path, "info.yml")
        shutil.copy(raw_yml_pkg_src, raw_data_dst)

    # Make sure small-baseline folders exists
    for dirname in ["models/small-baseline", "feature-files/small-baseline",
                    "preprocessed/small-baseline"]:
        directory = os.path.join(cfg['root'], dirname)
        if not os.path.exists(directory):
            os.makedirs(directory)

    # Make sure small-baseline yml files exist
    paths = [("preprocessed/small-baseline/", "preprocessing-small-info.yml"),
             ("feature-files/small-baseline/", "feature-small-info.yml"),
             ("models/small-baseline/", "model-small-info.yml")]
    for dest, src in paths:
        raw_data_dst = os.path.join(cfg['root'], "%s/info.yml" % dest)
        if not os.path.isfile(raw_data_dst):
            raw_yml_pkg_src = os.path.join(raw_yml_path, src)
            shutil.copy(raw_yml_pkg_src, raw_data_dst)

    return cfg['root']
955405
def get_git_home(path='.'):
    """"""
    ctx = click.get_current_context(silent=True)
    if ctx and GIT_KEY in ctx.meta:
        return ctx.meta[GIT_KEY]

    from git import Repo
    return Repo(path, search_parent_directories=True).working_dir
117497
protected File getHomeDir() {
        // check JNDI for the home directory first
        String varName = getApplicationName().toUpperCase() + "_HOME";
        try {
            InitialContext iniCtxt = new InitialContext();
            Context env = (Context) iniCtxt.lookup("java:comp/env");
            String value = (String) env.lookup(varName);
            if(value!=null && value.trim().length()>0)
                return new File(value.trim());
            // look at one more place. See HUDSON-1314
            value = (String) iniCtxt.lookup(varName);
            if(value!=null && value.trim().length()>0)
                return new File(value.trim());
        } catch (NamingException e) {
            // ignore
        }

        // finally check the system property
        String sysProp = System.getProperty(varName);
        if(sysProp!=null)
            return new File(sysProp.trim());

        // look at the env var next
        String env = System.getenv(varName);
        if(env!=null)
            return new File(env.trim()).getAbsoluteFile();

        return getDefaultHomeDir();
    }
963078
def path_locations(home_dir):
    """"""
    home_dir = os.path.abspath(home_dir)
    # XXX: We'd use distutils.sysconfig.get_python_inc/lib but its
    # prefix arg is broken: http://bugs.python.org/issue3386
    if is_win:
        # Windows has lots of problems with executables with spaces in
        # the name; this function will remove them (using the ~1
        # format):
        mkdir(home_dir)
        if ' ' in home_dir:
            import ctypes
            GetShortPathName = ctypes.windll.kernel32.GetShortPathNameW
            size = max(len(home_dir)+1, 256)
            buf = ctypes.create_unicode_buffer(size)
            try:
                u = unicode
            except NameError:
                u = str
            ret = GetShortPathName(u(home_dir), buf, size)
            if not ret:
                print('Error: the path "%s" has a space in it' % home_dir)
                print('We could not determine the short pathname for it.')
                print('Exiting.')
                sys.exit(3)
            home_dir = str(buf.value)
        lib_dir = join(home_dir, 'Lib')
        inc_dir = join(home_dir, 'Include')
        bin_dir = join(home_dir, 'Scripts')
    if is_jython:
        lib_dir = join(home_dir, 'Lib')
        inc_dir = join(home_dir, 'Include')
        bin_dir = join(home_dir, 'bin')
    elif is_pypy:
        lib_dir = home_dir
        inc_dir = join(home_dir, 'include')
        bin_dir = join(home_dir, 'bin')
    elif not is_win:
        lib_dir = join(home_dir, 'lib', py_version)
        inc_dir = join(home_dir, 'include', py_version + abiflags)
        bin_dir = join(home_dir, 'bin')
    return home_dir, lib_dir, inc_dir, bin_dir