1{ lib
2, boto3
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, jsonschema
7, mock
8, parameterized
9, pydantic
10, pytest-env
11, pytest-rerunfailures
12, pytest-xdist
13, pytestCheckHook
14, pythonOlder
15, pyyaml
16, typing-extensions
17}:
18
19buildPythonPackage rec {
20 pname = "aws-sam-translator";
21 version = "1.60.1";
22 format = "setuptools";
23
24 disabled = pythonOlder "3.6";
25
26 src = fetchFromGitHub {
27 owner = "aws";
28 repo = "serverless-application-model";
29 rev = "refs/tags/v${version}";
30 hash = "sha256-exVB1STX8OsFnQ0pzSuR3O/FrvG2GR5MdZa8tZ9IJvI=";
31 };
32
33 propagatedBuildInputs = [
34 boto3
35 jsonschema
36 pydantic
37 typing-extensions
38 ];
39
40 patches = [
41 (fetchpatch {
42 # relax typing-extenions dependency
43 url = "https://github.com/aws/serverless-application-model/commit/d1c26f7ad9510a238ba570d511d5807a81379d0a.patch";
44 hash = "sha256-nh6MtRgi0RrC8xLkLbU6/Ec0kYtxIG/fgjn/KLiAM0E=";
45 })
46 ];
47
48 postPatch = ''
49 substituteInPlace requirements/base.txt \
50 --replace "jsonschema~=3.2" "jsonschema>=3.2"
51 substituteInPlace pytest.ini \
52 --replace " --cov samtranslator --cov-report term-missing --cov-fail-under 95" ""
53 '';
54
55 nativeCheckInputs = [
56 parameterized
57 pytest-env
58 pytest-rerunfailures
59 pytest-xdist
60 pytestCheckHook
61 pyyaml
62 ];
63
64 doCheck = false; # tests fail in weird ways
65
66 pythonImportsCheck = [
67 "samtranslator"
68 ];
69
70 meta = with lib; {
71 description = "Python library to transform SAM templates into AWS CloudFormation templates";
72 homepage = "https://github.com/awslabs/serverless-application-model";
73 license = licenses.asl20;
74 maintainers = with maintainers; [ ];
75 };
76}