Esempio n. 1
0
 def abscommand(self):
     """The absolute path of the command."""
     if os.name == "nt":
         # on Windows, newer versions of LilyPond don't add themselves to the
         # PATH, so add a probable path here
         path = glob.glob(os.path.join(
             os.environ.get('ProgramFiles', 'C:\\Program Files'),
             'LilyPond*', 'usr', 'bin'))
     elif sys.platform.startswith('darwin'):
         # also on Mac OS X, LilyPond is not automatically added to the PATH
         path = [
             os.path.join('/Applications', 'LilyPond.app', 'Contents', 'Resources', 'bin'),
             os.path.join('/opt', 'local', 'bin'),
             os.path.join('/opt', 'lilypond', 'bin'),
             # Default path for Homebrew on MacOS arm64.
             '/opt/homebrew/bin',
             # Default path for Homebrew on MacOS x86_64.
             '/usr/local/bin',
         ]
         if macosx.inside_app_bundle():
             # By default, the PATH environment variable for app bundles
             # does not contain the path which is required for lilypond
             # and other helper programs like gs.
             # Add the lilypond path to PATH to find the helper programs
             # for Homebrew, Macports and other local installations.
             exe = util.findexe(self.command, path)
             if exe:
                 bindir = os.path.dirname(exe)
                 os.environ['PATH'] = bindir + ':' + os.environ['PATH']
     else:
         path = None
     return util.findexe(self.command, path) or False
Esempio n. 2
0
 def mac_installation_kind():
     import macosx
     if macosx.inside_lightweight_app_bundle():
         return 'lightweight .app bundle'
     elif macosx.inside_app_bundle():
         return 'standalone .app bundle'
     else:
         return 'command line'
Esempio n. 3
0
 def mac_installation_kind():
     import macosx
     if macosx.inside_app_bundle():
         if os.path.islink(os.getcwd() + '/../MacOS/python'):
             return 'lightweight app bundle'
         else:
             return 'standalone app bundle'
     else:
         return 'command line'
Esempio n. 4
0
 def mac_installation_kind():
     import macosx
     if macosx.inside_app_bundle():
         if os.path.islink(os.getcwd() + '/../MacOS/python'):
             return 'lightweight app bundle'
         else:
             return 'standalone app bundle'
     else:
         return 'command line'
Esempio n. 5
0
    def configure_command(self):
        """Compose the command line for a LilyPond job using all options.
        Individual steps may be overridden in subclasses."""
        self.command = cmd = ([
            self.lilypond_info.abscommand() or self.lilypond_info.command
        ])
        cmd.extend(serialize_d_options(self._d_options))
        cmd.extend(self.arguments())
        cmd.extend(self.paths(self.includepath))
        cmd.extend(self.backend_args())
        self.set_input_file()

        # By default, the PATH environment variable for app bundles is empty.
        # Setting it in __init__ is too early, since lilypond_info can be
        # changed in the custom engraving dialog; configure_command is called
        # just before starting the process.
        if sys.platform.startswith('darwin'):
            import macosx
            if macosx.inside_app_bundle() and self.lilypond_info.frommacports(
            ):
                self.environment['PATH'] = self.lilypond_info.bindir()
Esempio n. 6
0
 def translateUI(self):
     message = (_("<b>Could not load PyQtWebEngine, "
                  + "so the {tool} cannot be loaded.</b>").format(
                  tool = self.parentWidget().windowTitle()))
     if sys.platform.startswith('darwin'):
         import macosx
         if (macosx.inside_app_bundle()
                 and not macosx.inside_lightweight_app_bundle()):
             message = (
                 message + "<br><br>"
                 + _("PyQtWebEngine has been intentionally excluded from "
                     + "the application bundle: at the moment, including "
                     + "it results in a faulty application.<br><br>"
                     + "For more details, see <a href=\"{issue}\">issue #1244</a> "
                     + "on Frescobaldi's GitHub page.<br>"
                     + "For more information on alternative ways of running "
                     + "Frescobaldi, see the <a href=\"{wiki}\">relevant Wiki "
                     + "page</a> on GitHub.").format(
                     issue = "https://github.com/frescobaldi/frescobaldi/issues/1244",
                     wiki = "https://github.com/frescobaldi/frescobaldi/"
                            + "wiki/How-to-install-Frescobaldi-on-Mac-OS-X"))
     self._msg.setText(message)
Esempio n. 7
0
            windir,
            os.curdir
        ] + [p for p in os.environ['PATH'].split(os.pathsep) if p]
        for directory in search_paths:
            fname = os.path.join(directory, name)
            if os.path.exists(fname):
                return fname
            if fname.lower().endswith(".dll"):
                continue
            fname = fname + ".dll"
            if os.path.exists(fname):
                return fname
        return None

    dll_name = find_library(_PM_DLL['win32'], [os.path.dirname(__file__)])
elif sys.platform.startswith('darwin') and macosx.inside_app_bundle() and os.path.exists(_PM_MACOSX_APP):
    dll_name = _PM_MACOSX_APP
else:
    from ctypes.util import find_library
    dll_name = find_library(_PM_DLL.get(sys.platform, 'portmidi'))
if dll_name is None:
    raise ImportError("Couldn't find the PortMidi library.")

libpm = CDLL(dll_name)
# The portmidi library may be linked against porttime but not export its
# symbols. Then we need to load the porttime library as well.
if hasattr(libpm, 'Pt_Time'):
    libpt = libpm
else:
    libpt = CDLL(find_library(_PT_DLL.get(sys.platform, 'porttime')))
Esempio n. 8
0
            get_system_directory(),
            os.path.join(windir, 'System'), windir, os.curdir
        ] + [p for p in os.environ['PATH'].split(os.pathsep) if p]
        for directory in search_paths:
            fname = os.path.join(directory, name)
            if os.path.exists(fname):
                return fname
            if fname.lower().endswith(".dll"):
                continue
            fname = fname + ".dll"
            if os.path.exists(fname):
                return fname
        return None

    dll_name = find_library(_PM_DLL['win32'], [os.path.dirname(__file__)])
elif sys.platform.startswith('darwin') and macosx.inside_app_bundle(
) and os.path.exists(_PM_MACOSX_APP):
    dll_name = _PM_MACOSX_APP
else:
    from ctypes.util import find_library
    dll_name = find_library(_PM_DLL.get(sys.platform, 'portmidi'))
if dll_name is None:
    raise ImportError("Couldn't find the PortMidi library.")

libpm = CDLL(dll_name)
# The portmidi library may be linked against porttime but not export its
# symbols. Then we need to load the porttime library as well.
if hasattr(libpm, 'Pt_Time'):
    libpt = libpm
else:
    libpt = CDLL(find_library(_PT_DLL.get(sys.platform, 'porttime')))