Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jonasmalacofilho/18a5f425ad72ad3a0d660050c066c57f to your computer and use it in GitHub Desktop.

Select an option

Save jonasmalacofilho/18a5f425ad72ad3a0d660050c066c57f to your computer and use it in GitHub Desktop.

Revisions

  1. jonasmalacofilho created this gist Nov 1, 2019.
    31 changes: 31 additions & 0 deletions 0001-Patch-hardcoded-libusb-header-paths-in-cython-hidapi.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    From e1e0f8b79b3116d10a7cefc92b2203d700806b5c Mon Sep 17 00:00:00 2001
    From: Jonas Malaco <[email protected]>
    Date: Fri, 1 Nov 2019 01:38:43 +0000
    Subject: [PATCH 1/2] Patch hardcoded libusb header paths in cython-hidapi

    ---
    Formula/liquidctl.rb | 8 +++++++-
    1 file changed, 7 insertions(+), 1 deletion(-)

    diff --git a/Formula/liquidctl.rb b/Formula/liquidctl.rb
    index 3a6415d..e8830a2 100644
    --- a/Formula/liquidctl.rb
    +++ b/Formula/liquidctl.rb
    @@ -30,7 +30,13 @@ class Liquidctl < Formula
    end

    def install
    - virtualenv_install_with_resources
    + venv = virtualenv_create(libexec, "python3")
    + venv.pip_install resources.reject { |r| r.name == "hidapi" }
    + resource("hidapi").stage do
    + inreplace "setup.py", "/usr/include/", "#{Formula["libusb"].include}/"
    + venv.pip_install "."
    + end
    + venv.pip_install_and_link buildpath
    end

    test do
    --
    2.20.1

    28 changes: 28 additions & 0 deletions 0002-Simplify-the-tests.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    From f073459a9a212bb17f0c7a79ce6bef5bda058716 Mon Sep 17 00:00:00 2001
    From: Jonas Malaco <[email protected]>
    Date: Fri, 1 Nov 2019 01:39:41 +0000
    Subject: [PATCH 2/2] Simplify the tests

    ---
    Formula/liquidctl.rb | 6 +-----
    1 file changed, 1 insertion(+), 5 deletions(-)

    diff --git a/Formula/liquidctl.rb b/Formula/liquidctl.rb
    index e8830a2..e0a48f6 100644
    --- a/Formula/liquidctl.rb
    +++ b/Formula/liquidctl.rb
    @@ -40,10 +40,6 @@ class Liquidctl < Formula
    end

    test do
    - assert_predicate bin/"liquidctl", :exist?
    - assert_predicate bin/"liquidctl", :executable?
    -
    - version_output = shell_output("#{bin}/liquidctl --version 2>&1", 1)
    - assert_match "liquidctl #{version}", version_output
    + shell_output("#{bin}/liquidctl list", 0)
    end
    end
    --
    2.20.1

    31 changes: 31 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    From e1e0f8b79b3116d10a7cefc92b2203d700806b5c Mon Sep 17 00:00:00 2001
    From: Jonas Malaco <[email protected]>
    Date: Fri, 1 Nov 2019 01:38:43 +0000
    Subject: [PATCH 1/2] Patch hardcoded libusb header paths in cython-hidapi

    ---
    Formula/liquidctl.rb | 8 +++++++-
    1 file changed, 7 insertions(+), 1 deletion(-)

    diff --git a/Formula/liquidctl.rb b/Formula/liquidctl.rb
    index 3a6415d..e8830a2 100644
    --- a/Formula/liquidctl.rb
    +++ b/Formula/liquidctl.rb
    @@ -30,7 +30,13 @@ class Liquidctl < Formula
    end

    def install
    - virtualenv_install_with_resources
    + venv = virtualenv_create(libexec, "python3")
    + venv.pip_install resources.reject { |r| r.name == "hidapi" }
    + resource("hidapi").stage do
    + inreplace "setup.py", "/usr/include/", "#{Formula["libusb"].include}/"
    + venv.pip_install "."
    + end
    + venv.pip_install_and_link buildpath
    end

    test do
    --
    2.20.1

    28 changes: 28 additions & 0 deletions gistfile2.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    From f073459a9a212bb17f0c7a79ce6bef5bda058716 Mon Sep 17 00:00:00 2001
    From: Jonas Malaco <[email protected]>
    Date: Fri, 1 Nov 2019 01:39:41 +0000
    Subject: [PATCH 2/2] Simplify the tests

    ---
    Formula/liquidctl.rb | 6 +-----
    1 file changed, 1 insertion(+), 5 deletions(-)

    diff --git a/Formula/liquidctl.rb b/Formula/liquidctl.rb
    index e8830a2..e0a48f6 100644
    --- a/Formula/liquidctl.rb
    +++ b/Formula/liquidctl.rb
    @@ -40,10 +40,6 @@ class Liquidctl < Formula
    end

    test do
    - assert_predicate bin/"liquidctl", :exist?
    - assert_predicate bin/"liquidctl", :executable?
    -
    - version_output = shell_output("#{bin}/liquidctl --version 2>&1", 1)
    - assert_match "liquidctl #{version}", version_output
    + shell_output("#{bin}/liquidctl list", 0)
    end
    end
    --
    2.20.1