diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 30a1fcba9..f17571f0d 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -660,8 +660,8 @@ def cpu_count(): num = 0 elif sys.platform == b'darwin': try: - num = int(command_output([b'sysctl', b'-n', b'hw.ncpu'])) - except ValueError: + num = int(command_output([b'/usr/sbin/sysctl', b'-n', b'hw.ncpu'])) + except (ValueError, OSError, subprocess.CalledProcessError): num = 0 else: try: diff --git a/docs/changelog.rst b/docs/changelog.rst index a0e7d70c3..196795698 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -71,6 +71,8 @@ Fixes: * Fix an edge case when producing sanitized filenames where the maximum path length conflicted with the :ref:`replace` rules. Thanks to Ben Ockmore. :bug:`496` :bug:`1361` +* Fix an incompatibility with OS X 10.11 (where ``/usr/sbin`` seems not to be + on the user's path by default). 1.3.13 (April 24, 2015) diff --git a/extra/_beet b/extra/_beet index 1987ed57c..a7533d9a7 100644 --- a/extra/_beet +++ b/extra/_beet @@ -18,6 +18,10 @@ function _beet_field_values() { local -a output fieldvals local library="$(beet config|grep library|cut -f 2 -d ' ')" + if [ -z "$library" ]; then + # Use default library location if there is no user defined one + library="~/.config/beets/library.db" + fi output=$(sqlite3 ${~library} "select distinct $1 from items;") case $1 in @@ -50,7 +54,7 @@ query=( \( "$matchquery" ":query:query string:{_beet_query}" \) \( "$matchquery" modify=( \( "$matchmodify" ":modify:modify string:$modifyelem" \) \( "$matchmodify" ":modify:modify string:$modifyelem" \) \# ) # arguments to _regex_arguments for completing files and directories -local -a files dirs +local -a files dirs files=("$matchany" ':file:file:_files') dirs=("$matchany" ':dir:directory:_dirs') @@ -82,7 +86,7 @@ retagopt='-L:retag items matching a query:${query[@]}' skipopt='-i:skip already-imported directories' noskipopt='-I:do not skip already-imported directories' flatopt='--flat:import an entire tree as a single album' -groupopt='-g:group tracks in a folder into seperate albums' +groupopt='-g:group tracks in a folder into seperate albums' editopt='-e:edit user configuration with $EDITOR' defaultopt='-d:include the default configuration' copynomoveopt='-c:copy instead of moving' @@ -184,7 +188,7 @@ do options=( "${reply[@]}" \# "${query[@]}" ) ;; (stats) - _regex_words options "stats options" "$helpopt" "$exactopt" + _regex_words options "stats options" "$helpopt" "$exactopt" options=( "${reply[@]}" \# "${query[@]}" ) ;; (update) @@ -200,9 +204,9 @@ do ;; (help) # The help subcommand is treated separately - continue + continue ;; - (*) # completions for plugin commands are generated using _beet_subcmd_options + (*) # completions for plugin commands are generated using _beet_subcmd_options _beet_subcmd_options "$subcmd" options=( \( "${reply[@]}" \# "${query[@]}" \) ) ;; @@ -237,6 +241,6 @@ zstyle ":completion:${curcontext}:" tag-order '! options' # Execute the completion function _beet "$@" -# Local Variables: +# Local Variables: # mode:shell-script # End: diff --git a/test/test_mb.py b/test/test_mb.py index c1c93bbdc..7662e0722 100644 --- a/test/test_mb.py +++ b/test/test_mb.py @@ -471,7 +471,7 @@ class MBLibraryTest(unittest.TestCase): ai = list(mb.match_album('hello', 'there'))[0] sp.assert_called_with(artist='hello', release='there', limit=5) - gp.assert_calledwith(mbid) + gp.assert_called_with(mbid, mock.ANY) self.assertEqual(ai.tracks[0].title, 'foo') self.assertEqual(ai.album, 'hi')