Пример #1
0
    def _install_desktop_entry(self, tp):
        # Handle the special placeholders in the specified command.  For a
        # filebrowser request, we simply used the passed filebrowser.  But
        # for a webbrowser request, we invoke the Python standard lib's
        # webbrowser script so we can force the url(s) to open in new tabs.
        spec = self.shortcut.copy()
        spec['tp'] = tp

        path = self.path
        if tp == 'gnome':
            filebrowser = 'gnome-open'
            path += '.desktop'
        elif tp == 'kde':
            filebrowser = 'kfmclient openURL'
            path += 'KDE.desktop'

        cmd = self.cmd
        if cmd[0] == '{{FILEBROWSER}}':
            cmd[0] = filebrowser
        elif cmd[0] == '{{WEBBROWSER}}':
            import webbrowser
            executable = get_executable(self.prefix)
            cmd[0:1] = [executable, webbrowser.__file__, '-t']

        spec['cmd'] = cmd
        spec['path'] = path

        # create the shortcuts
        make_desktop_entry(spec)
Пример #2
0
    def __init__(self, path, prefix=sys.prefix,
                 hook=False, pkgs_dir=None, evt_mgr=None,
                 verbose=False, noapp=False):
        self.path = path
        self.fn = basename(path)
        name, version = name_version_fn(self.fn)
        self.cname = name.lower()
        self.prefix = abspath(prefix)
        self.hook = bool(hook)
        self.evt_mgr = evt_mgr
        self.noapp = noapp

        self.bin_dir = join(self.prefix, bin_dir_name)

        if self.prefix != abspath(sys.prefix):
            scripts.executable = get_executable(self.prefix)

        if self.hook:
            if pkgs_dir:
                self.pkgs_dir = abspath(pkgs_dir)
            else:
                self.pkgs_dir = join(self.prefix, 'pkgs')
            self.pkg_dir = join(self.pkgs_dir, self.cname + '-' + version)
            self.pyloc = self.pkg_dir
            self.meta_dir = join(self.pkg_dir, 'EGG-INFO')
            self.registry_txt = join(self.meta_dir, 'registry.txt')
        else:
            self.site_packages = join(self.prefix, rel_site_packages)
            self.pyloc = self.site_packages
            self.egginfo_dir = join(self.prefix, 'EGG-INFO')
            self.meta_dir = join(self.egginfo_dir, self.cname)

        self.meta_json = join(self.meta_dir, 'egginst.json')
        self.files = []
        self.verbose = verbose
Пример #3
0
    def __init__(self, path, prefix=sys.prefix,
                 hook=False, pkgs_dir=None, evt_mgr=None,
                 verbose=False, noapp=False):
        self.path = path
        self.fn = basename(path)
        name, version = name_version_fn(self.fn)
        self.cname = name.lower()
        self.prefix = abspath(prefix)
        self.hook = bool(hook)
        self.evt_mgr = evt_mgr
        self.noapp = noapp

        self.bin_dir = join(self.prefix, bin_dir_name)

        if self.prefix != abspath(sys.prefix):
            scripts.executable = get_executable(self.prefix)

        if self.hook:
            warnings.warn("Hook feature not supported anymore", DeprecationWarning)
        else:
            self.site_packages = join(self.prefix, rel_site_packages)
            self.pyloc = self.site_packages
            self.egginfo_dir = join(self.prefix, 'EGG-INFO')
            self.meta_dir = join(self.egginfo_dir, self.cname)

        self.meta_json = join(self.meta_dir, 'egginst.json')
        self.files = []
        self.verbose = verbose
Пример #4
0
    def __init__(self,
                 path,
                 prefix=sys.prefix,
                 hook=False,
                 pkgs_dir=None,
                 evt_mgr=None,
                 verbose=False,
                 noapp=False):
        self.path = path
        self.fn = basename(path)
        name, version = name_version_fn(self.fn)
        self.cname = name.lower()
        self.prefix = abspath(prefix)
        self.hook = bool(hook)
        self.evt_mgr = evt_mgr
        self.noapp = noapp

        self.bin_dir = join(self.prefix, bin_dir_name)

        if self.prefix != abspath(sys.prefix):
            scripts.executable = get_executable(self.prefix)

        if self.hook:
            if pkgs_dir:
                self.pkgs_dir = abspath(pkgs_dir)
            else:
                self.pkgs_dir = join(self.prefix, 'pkgs')
            self.pkg_dir = join(self.pkgs_dir, self.cname + '-' + version)
            self.pyloc = self.pkg_dir
            self.meta_dir = join(self.pkg_dir, 'EGG-INFO')
            self.registry_txt = join(self.meta_dir, 'registry.txt')
        else:
            self.site_packages = join(self.prefix, rel_site_packages)
            self.pyloc = self.site_packages
            self.egginfo_dir = join(self.prefix, 'EGG-INFO')
            self.meta_dir = join(self.egginfo_dir, self.cname)

        self.meta_json = join(self.meta_dir, 'egginst.json')
        self.files = []
        self.verbose = verbose
Пример #5
0
import os
import pandas
import sys

import matplotlib.pyplot as plt
import seaborn

ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__), "../"))
sys.path.append(ROOT)
from utils import run_repeatable, get_executable

data = []
for res in run_repeatable(get_executable(), 1, [], True):
    data += [float(time) for time in res.split("\n")]

# remove outliers (https://stackoverflow.com/a/43279492/1107768)
frame = pandas.DataFrame({'duration': data})
q1 = frame['duration'].quantile(0.25)
q3 = frame['duration'].quantile(0.75)
iqr = q3 - q1

q1 = q1 - 1.5 * iqr
q3 = q3 + 1.5 * iqr

mask = frame['duration'].between(q1, q3, inclusive=True)
filtered = frame.loc[mask, 'duration']

g = seaborn.distplot(filtered, kde=False)
g.set(xlabel="Duration between slow iterations (ns)")
plt.show()