Esempio n. 1
0
 def __desktop_entry(self):
     import gio
     app_infos = gio.app_info_get_all()
     for app_info in app_infos:
         if app_info.get_name() == blaconst.APPNAME:
             return blautil.toss_extension(app_info.get_id())
     return ""
Esempio n. 2
0
    def run(self):
        base = os.path.dirname(__file__)

        self.mkpath(self.build_dir)
        for script in self.scripts:
            newpath = os.path.join(
                base, self.build_dir, os.path.basename(script))
            if newpath.lower().endswith(".py"):
                newpath = blautil.toss_extension(newpath)
            if newer(script, newpath) or self.force:
                self.copy_file(script, newpath)
Esempio n. 3
0
    def run(self):
        d_clean.run(self)

        base = os.path.abspath(os.path.dirname(__file__))

        for mod in self.distribution.ext_modules:
            paths = [os.path.abspath("%s.c" % blautil.toss_extension(src))
                     for src in mod.sources]
            paths.append(
                os.path.join(base, "%s.so" % mod.name.replace(".", "/")))
            for f in paths:
                try:
                    print "removing '%s'" % f
                    os.unlink(f)
                except OSError:
                    pass

        if not self.all:
            return

        for directory in ["build", "dist"]:
            path = os.path.join(base, directory)
            if os.path.isdir(path):
                shutil.rmtree(path)
Esempio n. 4
0
        self.cmdclass.setdefault("install_shortcuts", install_shortcuts)
        self.cmdclass.setdefault("build", build)
        self.cmdclass.setdefault("install", install)


if __name__ == "__main__":
    description = "Minimalist audio player for GNU/Linux written in Python"

    # Spectrum visualization
    extra_compile_args = ["-std=gnu99", "-funroll-loops"]
    try:
        extra_compile_args.append("-I%s" % np.get_include())
    except AttributeError:
        pass
    path = "blaplay/blagui/blaspectrum.pyx"
    ext_modules = [Extension(blautil.toss_extension(path.replace("/", ".")),
                             [path], libraries=["fftw3f"],
                             extra_compile_args=extra_compile_args)]

    # Icons
    base = "blaplay/images"
    images_comps = []
    for dirname, dirs, filenames in os.walk(base):
        for filename in filenames:
            images_comps.append(os.path.join(dirname, filename)[len(base)+1:])

    # Collect all parameters.
    kwargs = {
        "name": blaconst.APPNAME,
        "version": blaconst.VERSION,
        "author": blaconst.AUTHOR,
Esempio n. 5
0
    except AttributeError as exc:
        print_d("Failed to initialize \"%s\" visualization: %s" %
                (identifier, exc))
        return None
    return format_

# Every module name in the formats package except those defining a format start
# with an underscore. We filter module sources by this. Everything that passes
# is treated like a format. Format classes have the same name as the module
# name, but with capitalized first letter.
# FIXME: some distributions might not install the py-files. to avoid being
#        overly specific when it comes to extensions just filter out every file
#        which starts with an underscore, put all passed names into a set() and
#        iterate over this instead
for module in filter(_is_py_file, os.listdir(os.path.dirname(__file__))):
    basename = blautil.toss_extension(module)
    name = basename.capitalize()

    try:
        module = __import__(
            "blaplay.formats.%s" % basename, {}, {}, name)
        format_ = getattr(module, name)
    except Exception as exc:
        print_d("Failed to import module \"%s\": %r" % (module, exc))
    else:
        format_ = _check_module_integrity(module, name)
        if format_:
            for ext in format_.extensions:
                # FIXME: with the addition of video support we overwrite
                #        certain extension handlers here, e.g. mp4
                formats[ext] = format_