Loading pkgs/development/python-modules/manuf/default.nix 0 → 100644 +60 −0 Original line number Diff line number Diff line { lib , buildPythonPackage , fetchFromGitHub , runCommand , python3 , wireshark-cli , pytestCheckHook }: buildPythonPackage rec { pname = "manuf"; version = "1.1.5"; format = "setuptools"; src = fetchFromGitHub { owner = "coolbho3k"; repo = "manuf"; rev = "${version}"; hash = "sha256-3CFs3aqwE8rZPwU1QBqAGxNHT5jg7ymG12yBD56gTNI="; }; nativeBuildInputs = [ wireshark-cli ]; patches = [ # Do update while building package from wireshark-cli ./internal_db_update_nix.patch # Fix MANUF_URL for external db update functionality (https://github.com/coolbho3k/manuf/issues/34) ./fix_manuf_url.patch ]; postPatch = '' cat ${wireshark-cli}/share/wireshark/{manuf,wka} > manuf/manuf ''; nativeCheckInputs = [ pytestCheckHook ]; disabledTests = [ "test_update_update" ]; pythonImportsCheck = [ "manuf" ]; passthru.tests = { testMacAddress = runCommand "${pname}-test" {} '' ${python3.pkgs.manuf}/bin/manuf BC:EE:7B:00:00:00 > $out [ "$(cat $out | tr -d '\n')" = "Vendor(manuf='ASUSTekC', manuf_long='ASUSTek COMPUTER INC.', comment=None)" ] ''; }; meta = with lib; { homepage = "https://github.com/coolbho3k/manuf"; description = " Parser library for Wireshark's OUI database"; mainProgram = "manuf"; platforms = platforms.linux; license = with licenses; [ lgpl3Plus asl20 ]; maintainers = with maintainers; [ dsuetin ]; }; } pkgs/development/python-modules/manuf/fix_manuf_url.patch 0 → 100644 +14 −0 Original line number Diff line number Diff line diff --git a/manuf/manuf.py b/manuf/manuf.py index 09e9687..0ac9296 100755 --- a/manuf/manuf.py +++ b/manuf/manuf.py @@ -61,7 +61,8 @@ class MacParser(object): IOError: If manuf file could not be found. """ - MANUF_URL = "https://gitlab.com/wireshark/wireshark/raw/master/manuf" + # https://github.com/coolbho3k/manuf/issues/34 + MANUF_URL = "https://www.wireshark.org/download/automated/data/manuf" WFA_URL = "https://gitlab.com/wireshark/wireshark/raw/master/wka" def __init__(self, manuf_name=None, update=False): pkgs/development/python-modules/manuf/internal_db_update_nix.patch 0 → 100644 +31 −0 Original line number Diff line number Diff line diff --git a/manuf/manuf.py b/manuf/manuf.py index e5e9193..09e9687 100755 --- a/manuf/manuf.py +++ b/manuf/manuf.py @@ -65,8 +65,14 @@ class MacParser(object): WFA_URL = "https://gitlab.com/wireshark/wireshark/raw/master/wka" def __init__(self, manuf_name=None, update=False): - self._manuf_name = manuf_name or self.get_packaged_manuf_file_path() - if update: + if manuf_name is not None: + self._manuf_name = manuf_name + self.external_db = True + else: + self._manuf_name = self.get_packaged_manuf_file_path() + self.external_db = False + + if update and self.external_db: self.update() else: self.refresh() @@ -134,6 +140,9 @@ class MacParser(object): URLError: If the download fails """ + if manuf_url is None and not self.external_db: + return + if not manuf_url: manuf_url = self.MANUF_URL if not manuf_name: pkgs/top-level/python-packages.nix +2 −0 Original line number Diff line number Diff line Loading @@ -6429,6 +6429,8 @@ self: super: with self; { manuel = callPackage ../development/python-modules/manuel { }; manuf = callPackage ../development/python-modules/manuf { }; mapbox = callPackage ../development/python-modules/mapbox { }; mapbox-earcut = callPackage ../development/python-modules/mapbox-earcut { }; Loading Loading
pkgs/development/python-modules/manuf/default.nix 0 → 100644 +60 −0 Original line number Diff line number Diff line { lib , buildPythonPackage , fetchFromGitHub , runCommand , python3 , wireshark-cli , pytestCheckHook }: buildPythonPackage rec { pname = "manuf"; version = "1.1.5"; format = "setuptools"; src = fetchFromGitHub { owner = "coolbho3k"; repo = "manuf"; rev = "${version}"; hash = "sha256-3CFs3aqwE8rZPwU1QBqAGxNHT5jg7ymG12yBD56gTNI="; }; nativeBuildInputs = [ wireshark-cli ]; patches = [ # Do update while building package from wireshark-cli ./internal_db_update_nix.patch # Fix MANUF_URL for external db update functionality (https://github.com/coolbho3k/manuf/issues/34) ./fix_manuf_url.patch ]; postPatch = '' cat ${wireshark-cli}/share/wireshark/{manuf,wka} > manuf/manuf ''; nativeCheckInputs = [ pytestCheckHook ]; disabledTests = [ "test_update_update" ]; pythonImportsCheck = [ "manuf" ]; passthru.tests = { testMacAddress = runCommand "${pname}-test" {} '' ${python3.pkgs.manuf}/bin/manuf BC:EE:7B:00:00:00 > $out [ "$(cat $out | tr -d '\n')" = "Vendor(manuf='ASUSTekC', manuf_long='ASUSTek COMPUTER INC.', comment=None)" ] ''; }; meta = with lib; { homepage = "https://github.com/coolbho3k/manuf"; description = " Parser library for Wireshark's OUI database"; mainProgram = "manuf"; platforms = platforms.linux; license = with licenses; [ lgpl3Plus asl20 ]; maintainers = with maintainers; [ dsuetin ]; }; }
pkgs/development/python-modules/manuf/fix_manuf_url.patch 0 → 100644 +14 −0 Original line number Diff line number Diff line diff --git a/manuf/manuf.py b/manuf/manuf.py index 09e9687..0ac9296 100755 --- a/manuf/manuf.py +++ b/manuf/manuf.py @@ -61,7 +61,8 @@ class MacParser(object): IOError: If manuf file could not be found. """ - MANUF_URL = "https://gitlab.com/wireshark/wireshark/raw/master/manuf" + # https://github.com/coolbho3k/manuf/issues/34 + MANUF_URL = "https://www.wireshark.org/download/automated/data/manuf" WFA_URL = "https://gitlab.com/wireshark/wireshark/raw/master/wka" def __init__(self, manuf_name=None, update=False):
pkgs/development/python-modules/manuf/internal_db_update_nix.patch 0 → 100644 +31 −0 Original line number Diff line number Diff line diff --git a/manuf/manuf.py b/manuf/manuf.py index e5e9193..09e9687 100755 --- a/manuf/manuf.py +++ b/manuf/manuf.py @@ -65,8 +65,14 @@ class MacParser(object): WFA_URL = "https://gitlab.com/wireshark/wireshark/raw/master/wka" def __init__(self, manuf_name=None, update=False): - self._manuf_name = manuf_name or self.get_packaged_manuf_file_path() - if update: + if manuf_name is not None: + self._manuf_name = manuf_name + self.external_db = True + else: + self._manuf_name = self.get_packaged_manuf_file_path() + self.external_db = False + + if update and self.external_db: self.update() else: self.refresh() @@ -134,6 +140,9 @@ class MacParser(object): URLError: If the download fails """ + if manuf_url is None and not self.external_db: + return + if not manuf_url: manuf_url = self.MANUF_URL if not manuf_name:
pkgs/top-level/python-packages.nix +2 −0 Original line number Diff line number Diff line Loading @@ -6429,6 +6429,8 @@ self: super: with self; { manuel = callPackage ../development/python-modules/manuel { }; manuf = callPackage ../development/python-modules/manuf { }; mapbox = callPackage ../development/python-modules/mapbox { }; mapbox-earcut = callPackage ../development/python-modules/mapbox-earcut { }; Loading