Source: python-rtmidi
Version: 1.2.0~rc1-2
Followup-For: Bug #883709

Hello.

My previous suggestions for python-rtmidi were buggy in many respects.
Especially, the build time tests now fail.
The attached patch hopefully fixes all remaining issues.

The problem with tests was introduced by the "patch", so I am using
the same bug log. Reopening it would only cause confusion, though.

I have submitted a patch to rtmidi that should eventually allow
python-rtmidi to use the unpatched rtmidi library. For now, the
python-rtmidi author has good reasons to use a patched version.

I have also changed the upstream version, because the special meaning
of ~ in Debian was confusing uscan and there is no reason for it
anyway.  You have to decide whether to revert this part of my patch,
or rename the orig tarball.

I can prepare an NMU if this helps.

Thanks.
>From 84a98d282897b07d2f5689cadbb25004d2206132 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <nico...@debian.org>
Date: Sat, 5 Jan 2019 17:20:47 +0100
Subject: [PATCH] Fix test. Revert to embedded RtMidi. Debhelper 12.

* Revert to the embedded RtMidi, explain why in README.source.
* Fix upstream version in this changelog (remove ~).
* Switch to debhelper compatibility level 12.
* Add forgotten Rules-Requires-Root: no field.
* Let the run time test check a C call in addition to basic import.
  Prevent the rtmidi subdirectory hiding the installed one.

The upstream tarball must be renamed according to the new version.
---
 debian/README.source                          | 11 +++
 debian/changelog                              | 12 ++++
 debian/compat                                 |  1 -
 debian/control                                |  5 +-
 .../build-with-packaged-rtmidi-header.diff    | 31 --------
 debian/patches/series                         |  2 -
 .../patches/update-for-rtmidi-3.0.0~ds1.diff  | 71 -------------------
 debian/rules                                  | 13 +---
 debian/tests/control                          |  3 +-
 9 files changed, 30 insertions(+), 119 deletions(-)
 create mode 100644 debian/README.source
 delete mode 100644 debian/compat
 delete mode 100644 debian/patches/build-with-packaged-rtmidi-header.diff
 delete mode 100644 debian/patches/series
 delete mode 100644 debian/patches/update-for-rtmidi-3.0.0~ds1.diff

diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..fbf8b92
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,11 @@
+The upstream maintainer recompiles and links statically with RtMidi
+instead of using the packaged librtmidi-dev in order to increase
+RT_SYSEX_BUFFER_SIZE 8192.
+
+He also updates to latest version.
+At the time of this writing, commit
+  5591559e38d11d121c70b5697ec63992d96f4195
+of python-rtmidi picks src/RtMidi.{cpp,h} from commit
+  cadfcf6, between 3.0.0 and next unreleased version.
+
+ -- Nicolas Boulenguez <nico...@debian.org>, Sat,  5 Jan 2019 13:14:09 +0100
diff --git a/debian/changelog b/debian/changelog
index 3fddddc..ab375ff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+python-rtmidi (1.2.0rc1-3) unstable; urgency=medium
+
+  [ Nicolas Boulenguez ]
+  * Revert to the embedded RtMidi, explain why in README.source.
+  * Fix upstream version in this changelog (remove ~).
+  * Switch to debhelper compatibility level 12.
+  * Add forgotten Rules-Requires-Root: no field.
+  * Let the run time test check a C call in addition to basic import.
+    Prevent the rtmidi subdirectory hiding the installed one.
+
+ -- Josue Ortega <jo...@debian.org>  Sat, 05 Jan 2019 09:15:49 +0100
+
 python-rtmidi (1.2.0~rc1-2) unstable; urgency=medium
 
   [ Nicolas Boulenguez ]
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index b4de394..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-11
diff --git a/debian/control b/debian/control
index 4fe22c9..81b9b8f 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,8 @@ Source: python-rtmidi
 Section: python
 Priority: optional
 Maintainer: Josue Ortega <jo...@debian.org>
-Build-Depends: debhelper (>=11),
+Build-Depends:
+ debhelper-compat (=12),
  dh-python,
  python3-all,
  python3-all-dev,
@@ -10,10 +11,10 @@ Build-Depends: debhelper (>=11),
  cython3 (>= 0.25.2),
  libasound-dev,
  libjack-dev,
- librtmidi-dev,
  python3-pytest,
  python3-mock
 Standards-Version: 4.3.0
+Rules-Requires-Root: no
 Homepage: http://trac.chrisarndt.de/code/wiki/python-rtmidi
 Vcs-Git: https://salsa.debian.org/debian/python-rtmidi.git
 Vcs-Browser: https://salsa.debian.org/debian/python-rtmidi
diff --git a/debian/patches/build-with-packaged-rtmidi-header.diff b/debian/patches/build-with-packaged-rtmidi-header.diff
deleted file mode 100644
index a4da362..0000000
--- a/debian/patches/build-with-packaged-rtmidi-header.diff
+++ /dev/null
@@ -1,31 +0,0 @@
-Description: build with packaged librtmidi-dev
- Embedded source copies are generally discouraged.
- More specifically, at the time of this writing:
-  - The two methods below have been removed from rtmidi.
-    Python-rtmidi, trusting obsolete headers, relies on the shared
-    library providing them, and will crash at run time.
-  - The list of indirect dependencies in d/control was obsolete,
-    adding a jack version different from the one used by librtmidi.
-Author: Nicolas Boulenguez <nico...@debian.org>
-Last-Update: 2018-12-29
-
---- a/setup.py
-+++ b/setup.py
-@@ -69,7 +69,7 @@
- 
- # Set up options for compiling the _rtmidi Extension
- if cythonize:
--    sources = [join(SRC_DIR, "_rtmidi.pyx"), join(SRC_DIR, "RtMidi.cpp")]
-+    sources = [join(SRC_DIR, "_rtmidi.pyx")]
- elif exists(join(SRC_DIR, "_rtmidi.cpp")):
-     cythonize = lambda x: x  # noqa
-     sources = [join(SRC_DIR, "_rtmidi.cpp"), join(SRC_DIR, "RtMidi.cpp")]
-@@ -85,7 +85,7 @@
- 
- define_macros = []
- include_dirs = [SRC_DIR]
--libraries = []
-+libraries = ["rtmidi"]
- library_dirs = []
- extra_link_args = []
- extra_compile_args = []
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index 7139b4f..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1,2 +0,0 @@
-build-with-packaged-rtmidi-header.diff
-update-for-rtmidi-3.0.0~ds1.diff
diff --git a/debian/patches/update-for-rtmidi-3.0.0~ds1.diff b/debian/patches/update-for-rtmidi-3.0.0~ds1.diff
deleted file mode 100644
index 5c8d6de..0000000
--- a/debian/patches/update-for-rtmidi-3.0.0~ds1.diff
+++ /dev/null
@@ -1,71 +0,0 @@
-Description: update the binding for rtmidi 3.0.0~ds1
-Author: Nicolas Boulenguez <nico...@debian.org>
-Last-Update: 2018-12-29
-
---- a/src/_rtmidi.pyx
-+++ b/src/_rtmidi.pyx
-@@ -201,8 +201,6 @@
-                                          void *userData)
- 
-     cdef cppclass RtMidi:
--        void setClientName( string &clientName );
--        void setPortName( string &portName );
-         unsigned int getPortCount()
-         string getPortName(unsigned int portNumber)
-         void openPort(unsigned int portNumber, string &portName) except +
-@@ -343,51 +341,12 @@
-         return s.decode(encoding, "ignore")
- 
-     def set_client_name(self, name):
--        """Set the name of the MIDI client.
--
--        Names with non-ASCII characters in them have to be passed as unicode
--        or UTF-8 encoded strings in Python 2.
--
--        Currently only supported by the ALSA API backend.
--
--        Exceptions:
--
--        ``NotImplementedError``
--            Raised when trying the backend API does not support changing the
--            client name.
--
--        """
--        if self.get_current_api() in (API_MACOSX_CORE, API_UNIX_JACK, API_WINDOWS_MM):
--            raise NotImplementedError(
--                "API backend does not support changing the client name.")
--
--        self.baseptr().setClientName(_to_bytes(name))
-+        """Deprecated method."""
-+        raise NotImplementedError ("Removed from latest RtMidi.")
- 
-     def set_port_name(self, name):
--        """Set the name of the currently opened port.
--
--        Names with non-ASCII characters in them have to be passed as unicode
--        or UTF-8 encoded strings in Python 2.
--
--        Currently only supported by the ALSA and JACK API backends.
--
--        Exceptions:
--
--        ``NotImplementedError``
--            Raised when trying the backend API does not support changing the
--            port name.
--        ``RtMidiError``
--            Raised when no port is currently opened.
--
--        """
--        if self.get_current_api() in (API_MACOSX_CORE, API_WINDOWS_MM):
--            raise NotImplementedError(
--                "API backend does not support changing the port name.")
--
--        if self._port is None:
--            raise RtMidiError("No port currently opened.")
--
--        self.baseptr().setPortName(_to_bytes(name))
-+        """Deprecated method."""
-+        raise NotImplementedError ("Removed from latest RtMidi.")
- 
-     def get_port_count(self):
-         """Return the number of available MIDI input or output ports."""
diff --git a/debian/rules b/debian/rules
index bd0d274..1ab5c95 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,20 +5,11 @@ export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 export PYBUILD_NAME=rtmidi
 
-%: src.bak
+%:
 	dh $@ --with python3 --buildsystem=pybuild
 
-src.bak:
-	  mv src src.bak
-	  mkdir src
-	  ln -st src ../src.bak/_rtmidi.pyx /usr/include/rtmidi/RtMidi.h
-
 override_dh_clean:
-	dh_clean python_rtmidi.egg-info/
-	if test -e src.bak; then \
-	  rm -fr src && \
-	  mv src.bak src; \
-	fi
+	dh_clean src/_rtmidi.cpp python_rtmidi.egg-info/
 
 override_dh_auto_test:
 #Overrides auto_test due to `/dev/snd/seq` is not available during
diff --git a/debian/tests/control b/debian/tests/control
index e058642..c3590ad 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1 +1,2 @@
-Test-Command: python3 -c "import rtmidi"
+Test-Command: cd $AUTOPKGTEST_TMP && python3 -c "import rtmidi;print(rtmidi.get_compiled_api())"
+# Avoid top source directory, where rtmidi/ hides the installed one.
-- 
2.20.1

Reply via email to