Merge branch 'sophist_fix_plugin_install' of git://github.com/Sophist-UK/picard into Sophist-UK-sophist_fix_plugin_install

Conflicts:
	NEWS.txt
This commit is contained in:
Michael Wiencek
2013-09-24 16:30:30 -05:00
4 changed files with 15 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
* A new tag, musicbrainz_releasetrackid, containing the MusicBrainz Track MBID
introduced in the May 2013 schema change release, is now written to files.
* Add %_recordingtitle% (PICARD-515)
* Fix plugin install bugs (PICARD-444)
Version 1.2 - 2013-03-30
* Picard now requires at least Python 2.6

View File

@@ -25,6 +25,7 @@ import picard.plugins
import traceback
from picard import config, log
from picard.const import USER_PLUGIN_DIR
from picard.util import os_path_samefile
_suffixes = [s[0] for s in imp.get_suffixes()]
@@ -195,7 +196,7 @@ class PluginManager(QtCore.QObject):
if plugin_name:
try:
dest_exists = os.path.exists(dest)
same_file = os.path.samefile(path, dest) if dest_exists else False
same_file = os_path_samefile(path, dest) if dest_exists else False
if os.path.isfile(path) and not (dest_exists and same_file):
shutil.copy(path, dest)
elif os.path.isdir(path) and not same_file:

View File

@@ -22,6 +22,7 @@ import os.path
import sys
from PyQt4 import QtCore, QtGui
from picard import config
from picard.const import USER_PLUGIN_DIR
from picard.util import encode_filename
from picard.ui.options import OptionsPage, register_options_page
from picard.ui.ui_options_plugins import Ui_PluginsOptionsPage
@@ -135,7 +136,7 @@ class PluginsOptionsPage(OptionsPage):
def install_plugin(self, path):
path = encode_filename(path)
file = os.path.basename(path)
dest = os.path.join(self.tagger.user_plugin_dir, file)
dest = os.path.join(USER_PLUGIN_DIR, file)
if os.path.exists(dest):
msgbox = QtGui.QMessageBox(self)
msgbox.setText("A plugin named %s is already installed." % file)
@@ -147,7 +148,7 @@ class PluginsOptionsPage(OptionsPage):
self.tagger.pluginmanager.install_plugin(path, dest)
def open_plugin_dir(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl(self.loader % self.tagger.user_plugin_dir, QtCore.QUrl.TolerantMode))
QtGui.QDesktopServices.openUrl(QtCore.QUrl(self.loader % USER_PLUGIN_DIR, QtCore.QUrl.TolerantMode))
def open_plugin_site(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl("http://musicbrainz.org/doc/Picard_Plugins", QtCore.QUrl.TolerantMode))

View File

@@ -400,3 +400,12 @@ def tracknum_from_filename(base_filename):
if numbers:
return numbers[0]
return -1
# Provide os.path.samefile equivalent which is missing in Python under Windows
if sys.platform == 'win32':
def os_path_samefile(p1, p2):
ap1 = os.path.abspath(p1)
ap2 = os.path.abspath(p2)
return ap1 == ap2
else:
os_path_samefile = os.path.samefile