From 60527b35a6ad0585180ae82a790a8f2f678f80f9 Mon Sep 17 00:00:00 2001 From: Taylor Date: Fri, 23 Jul 2021 00:43:38 -0400 Subject: [PATCH] Increase version to 1.3.0. Run all regression tests. I think I'll push this to pypi within the next 24 hours... if I can remember how to do that 5 years after the fact... --- .travis.yml | 60 ++++++++++----------- CHANGES | 6 +++ README.rst | 16 +++--- _convenience.py | 138 ------------------------------------------------ setup.py | 5 +- 5 files changed, 49 insertions(+), 176 deletions(-) delete mode 100644 _convenience.py diff --git a/.travis.yml b/.travis.yml index 40497a3..ebbb73d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,20 +14,20 @@ jobs: python: 3.9 before_install: - sudo apt-get install gstreamer1.0-tools gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav - #- name: "Python 3.6 on Ubuntu 18 (Bionic)" - # dist: bionic - # python: 3.6 - # before_install: - # - sudo apt-get install gstreamer1.0-tools gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav - # virtualenv: - # system_site_packages: true # Needed for python to be able to access gi on Linux. - #- name: "Python 2.7 on Ubuntu 14 (Trusty)" - # dist: trusty - # python: 2.7 - # before_install: - # - sudo apt-get install python-gi gstreamer1.0-tools gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav - # virtualenv: - # system_site_packages: true # Needed for python to be able to access gi on Linux. + - name: "Python 3.6 on Ubuntu 18 (Bionic)" + dist: bionic + python: 3.6 + before_install: + - sudo apt-get install gstreamer1.0-tools gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav + virtualenv: + system_site_packages: true # Needed for python to be able to access gi on Linux. + - name: "Python 2.7 on Ubuntu 14 (Trusty)" + dist: trusty + python: 2.7 + before_install: + - sudo apt-get install python-gi gstreamer1.0-tools gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav + virtualenv: + system_site_packages: true # Needed for python to be able to access gi on Linux. # >>> Each macOS Run costs ~250 Build Credits - running both macOSs costs ~500 Build Credits. Read NOTE at top. @@ -36,25 +36,25 @@ jobs: osx_image: xcode12.5 language: shell script: python3 test.py - #- name: "Python 2.7 on macOS 10.11 (El Capitan, 2015)" - # os: osx - # osx_image: xcode7.3 - # language: shell + - name: "Python 2.7 on macOS 10.11 (El Capitan, 2015)" + os: osx + osx_image: xcode7.3 + language: shell # >>> Each Windows run costs ~100 Build Credits - running both Windows costs ~200 Build Credits. Read NOTE at top. - #- name: "Python 2.7 on Windows" - # os: windows - # language: shell - # before_install: - # - choco install python --version 2.7.11 - # env: PATH=/c/Python27:/c/Python27/Scripts:/c/tools/python:/c/tools/python/Scripts:$PATH - #- name: "Python 3.9 on Windows" - # os: windows - # language: shell - # before_install: - # - choco install python --version 3.9.5 - # env: PATH=/c/Python39:/c/Python39/Scripts:$PATH + - name: "Python 2.7 on Windows" + os: windows + language: shell + before_install: + - choco install python --version 2.7.11 + env: PATH=/c/Python27:/c/Python27/Scripts:/c/tools/python:/c/tools/python/Scripts:$PATH + - name: "Python 3.9 on Windows" + os: windows + language: shell + before_install: + - choco install python --version 3.9.5 + env: PATH=/c/Python39:/c/Python39/Scripts:$PATH install: true # Makes it do nothing instead of trying to find a requirements.txt file. script: - python test.py diff --git a/CHANGES b/CHANGES index e5982f4..4d923d7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +1.3.0 (July 23, 2021) + + * Adds in an automated test suite. + * Non-ascii filepaths and filepaths with spaces should now consistently work. + * Path objects are supported now. + 1.2.1 (Feb. 27, 2016) * Fixes bug that prevented relative paths from working on OS X. diff --git a/README.rst b/README.rst index 645176a..590f1d5 100644 --- a/README.rst +++ b/README.rst @@ -39,16 +39,18 @@ On Windows, uses windll.winmm. WAVE and MP3 have been tested and are known to wo On OS X, uses AppKit.NSSound. WAVE and MP3 have been tested and are known to work. In general, anything QuickTime can play, playsound should be able to play, for OS X. -On Linux, uses GStreamer. Known to work on Ubuntu 14.04 and ElementaryOS Loki. +On Linux, uses GStreamer. Known to work on Ubuntu 14.04 and ElementaryOS Loki. I expect any Linux distro with a standard gnome desktop experience should work. -Requirements ------------- -I've only tested playsound it with Python 2.7 on Windows 7 and OS X 10.11, but -I expect that it should work on Windows XP thru 10 at least, OS X 10.5 and newer, -all versions of Linux, and Python 2.3 and newer. +If you'd like other Linux distros (or any other OS) to work, submit a PR adding in support for it, but please make sure it passes the tests (see below). + +Testing +------- +Playsound includes a small set of tests - if you're making a PR, please ensure that you have no regressions and all the tests pass on your local system. +Also make sure that Travis-CI, which runs these tests against Windows Server 2016, macOS 10.11 (El Capitan, 2015) and 11.3 (Big Sur, 2020), Ubuntu 14 (Trusty), and Ubuntu 18 (Bionic), for both Python 2.7 and 3.9, fully passes. +You can check the Travis-CI status for Playsound here: https://travis-ci.com/github/TaylorSMarks/playsound/builds Copyright --------- -This software is Copyright (c) 2016 Taylor Marks . +This software is Copyright (c) 2021 Taylor Marks . See the bundled LICENSE file for more information. diff --git a/_convenience.py b/_convenience.py deleted file mode 100644 index fcce71a..0000000 --- a/_convenience.py +++ /dev/null @@ -1,138 +0,0 @@ -""" -This module implements a callback function that is used by the C code to -add Python special methods to Objective-C classes with a suitable interface. -""" -from objc._objc import ( - _block_call, - _rescanClass, - currentBundle, - lookUpClass, - options, - selector, -) - -__all__ = ("addConvenienceForClass", "registerABCForClass") - -CLASS_METHODS = {} -CLASS_ABC = {} - - -def register(f): - options._class_extender = f - - -@register -def add_convenience_methods(cls, type_dict): - """ - Add additional methods to the type-dict of subclass 'name' of - 'super_class'. - CLASS_METHODS is a global variable containing a mapping from - class name to a list of Python method names and implementation. - Matching entries from both mappings are added to the 'type_dict'. - """ - for nm, value in CLASS_METHODS.get(cls.__name__, ()): - type_dict[nm] = value - - try: - for cls in CLASS_ABC[cls.__name__]: - cls.register(cls) - del CLASS_ABC[cls.__name__] - except KeyError: - pass - - -def register(f): - options._make_bundleForClass = f - - -@register -def makeBundleForClass(): - cb = currentBundle() - - def bundleForClass(cls): - return cb - - return selector(bundleForClass, isClassMethod=True) - - -def registerABCForClass(classname, *abc_class): - """ - Register *classname* with the *abc_class*-es when - the class becomes available. - """ - global CLASS_ABC - try: - CLASS_ABC += tuple(abc_class) - except KeyError: - CLASS_ABC = tuple(abc_class) - - options._mapping_count += 1 - _rescanClass(classname) - - -def addConvenienceForClass(classname, methods): - """ - Add the list with methods to the class with the specified name - """ - try: - CLASS_METHODS[classname] += tuple(methods) - except KeyError: - CLASS_METHODS[classname] = tuple(methods) - - options._mapping_count += 1 - _rescanClass(classname) - - -# -# Helper functions for converting data item to/from a representation -# that is usable inside Cocoa data structures. -# -# In particular: -# -# - Python "None" is stored as +[NSNull null] because Cocoa containers -# won't store NULL as a value (and this transformation is undone when -# retrieving data) -# -# - When a getter returns NULL in Cocoa the queried value is not present, -# that's converted to an exception in Python. -# - -_NULL = lookUpClass("NSNull").null() - - -def container_wrap(v): - if v is None: - return _NULL - return v - - -def container_unwrap(v, exc_type, *exc_args): - if v is None: - raise exc_type(*exc_args) - elif v is _NULL: - return None - return v - - -# -# -# Misc. small helpers -# -# - -addConvenienceForClass("NSNull", (("__bool__", lambda self: False),)) - -addConvenienceForClass( - "NSEnumerator", - ( - ("__iter__", lambda self: self), - ("__next__", lambda self: container_unwrap(self.nextObject(), StopIteration)), - ), -) - - -def __call__(self, *args, **kwds): - return _block_call(self, self.__block_signature__, args, kwds) - - -addConvenienceForClass("NSBlock", (("__call__", __call__),)) \ No newline at end of file diff --git a/setup.py b/setup.py index 6de428e..909a3ff 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ long_description = f.read() setup(name = 'playsound', - version = '1.2.1', + version = '1.3.0', description = long_description.splitlines()[2][1:-1], long_description = long_description, url = 'https://github.com/TaylorSMarks/playsound', @@ -32,6 +32,9 @@ 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Topic :: Multimedia :: Sound/Audio :: MIDI', 'Topic :: Multimedia :: Sound/Audio :: Players',