1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 packaging,
6 pan-python,
7 poetry-core,
8}:
9
10buildPythonPackage rec {
11 pname = "pan-os-python";
12 version = "1.12.3";
13 pyproject = true;
14
15 src = fetchPypi {
16 pname = "pan_os_python";
17 inherit version;
18 hash = "sha256-b3jHu//GX031UbApDzYjCUXpI5MOdHwk9mXVymsFttk=";
19 };
20
21 postPatch = ''
22 # Modernize project definition
23 substituteInPlace pyproject.toml \
24 --replace-fail 'poetry.masonry.api' 'poetry.core.masonry.api' \
25 --replace-fail 'poetry>=0.12' 'poetry-core' \
26 --replace-fail 'pan-python = "^0.17.0"' 'pan-python = "^0.25.0"'
27 substituteInPlace panos/__init__.py \
28 --replace-fail "from distutils.version import LooseVersion" "from packaging.version import Version as LooseVersion"
29 '';
30
31 dependencies = [
32 packaging
33 pan-python
34 ];
35
36 build-system = [ poetry-core ];
37
38 pythonImportsCheck = [ "panos" ];
39
40 meta = {
41 description = "Palo Alto Networks PAN-OS SDK for Python";
42 homepage = "https://github.com/PaloAltoNetworks/pan-os-python";
43 changelog = "https://github.com/PaloAltoNetworks/pan-os-python/releases/tag/v${version}";
44 license = lib.licenses.isc;
45 maintainers = with lib.maintainers; [ jherland ];
46 };
47}