Skip to content

Commit

Permalink
Merge cabdc10 into 5f4a340
Browse files Browse the repository at this point in the history
  • Loading branch information
danieroux committed Mar 7, 2024
2 parents 5f4a340 + cabdc10 commit 99230f6
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 4 deletions.
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4265,6 +4265,12 @@
githubId = 160084;
name = "Daniel Sidhion";
};
danieroux = {
email = "danie@danieroux.com";
github = "danieroux";
githubId = 13940;
name = "Danie Roux";
};
daniyalsuri6 = {
email = "daniyal.suri@gmail.com";
github = "daniyalsuri6";
Expand Down
9 changes: 5 additions & 4 deletions pkgs/development/python-modules/bc-python-hcl2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ buildPythonPackage rec {
];

meta = with lib; {
description = "Parser for HCL2 written in Python using Lark";
description = "Parser for HCL2 written in Python using Lark - an incompatible fork of python-hcl2";
longDescription = ''
This parser only supports HCL2 and isn't backwards compatible with HCL v1.
It can be used to parse any HCL2 config file such as Terraform.
This is a fork of the Python HCL2 repo by Amplify and is officially supported by Bridgecrew.
The two projects are now deviating in a way that pushing new changes upstream doesn't make sense anymore.
'';
# Although this is the main homepage from PyPi but it is also a homepage
# of another PyPi package (python-hcl2). But these two are different.
homepage = "https://github.com/amplify-education/python-hcl2";
homepage = "https://github.com/bridgecrewio/python-hcl2";
license = licenses.mit;
maintainers = with maintainers; [ anhdle14 ];
};
Expand Down
62 changes: 62 additions & 0 deletions pkgs/development/python-modules/python-hcl2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# A fork is available here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/bc-python-hcl2/default.nix
# This is the original.

{ buildPythonPackage
, fetchFromGitHub
, lark
, lib
, python
, pythonOlder
, setuptools
, setuptools-scm
}:

buildPythonPackage rec {
pname = "python-hcl2";
version = "4.3.2";
format = "pyproject";

disabled = pythonOlder "3.6";

src = fetchFromGitHub {
owner = "amplify-education";
repo = "python-hcl2";
rev = "v${version}";
hash = "sha256-AsI5JlymwfwyvoLefdPQRg2zks7Hmdea9tYVD1PBpaY=";
};

nativeBuildInputs = [
setuptools
setuptools-scm
];

# Can not figure out how to make tox happy because:
# - tox.ini calls pip in the testenv: https://github.com/amplify-education/python-hcl2/blob/e3f1192e5d9e00025c9b88fb3b66b2ad99447aaf/tox.ini#L15
# - how do we pass the nix python env to tox?
doCheck = false;

propagatedBuildInputs = [
lark
];

pythonImportsCheck = [
"hcl2"
];

# Generate Lark Parser
# https://github.com/amplify-education/python-hcl2/blob/e3f1192e5d9e00025c9b88fb3b66b2ad99447aaf/.github/workflows/publish.yml#L19
preBuild = ''
${python.interpreter} hcl2/parser.py
'';

meta = with lib; {
description = "Parser for HCL2 (Terraform config file format) written in Python using Lark";
longDescription = ''
This parser only supports HCL2 and isn't backwards compatible with HCL v1.
It can be used to parse any HCL2 config file such as Terraform.
'';
homepage = "https://github.com/amplify-education/python-hcl2";
license = licenses.mit;
maintainers = with maintainers; [ danieroux ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9778,6 +9778,8 @@ self: super: with self; {

python-heatclient = callPackage ../development/python-modules/python-heatclient { };

python-hcl2 = callPackage ../development/python-modules/python-hcl2 { };

python-hl7 = callPackage ../development/python-modules/python-hl7 { };

python-ipmi = callPackage ../development/python-modules/python-ipmi { };
Expand Down

0 comments on commit 99230f6

Please sign in to comment.