Skip to content

Commit f710a20

Browse files
authored
Update setup.py
1 parent 696fe0f commit f710a20

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

setup.py

+13
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from glob import glob
1717
import sys
1818
import json
19+
import subprocess
1920

2021
from setuptools import setup, find_packages
2122

@@ -28,6 +29,18 @@ def read(fname):
2829
def read_version():
2930
return read("VERSION").strip()
3031

32+
def source_version():
33+
source_version = os.getenv('CODEBUILD_RESOLVED_SOURCE_VERSION')
34+
if source_version is None:
35+
source_version = subprocess.check_output(['git', 'rev-parse', '--verify', 'HEAD']).decode('utf-8').strip()
36+
return source_version
37+
38+
def generate_build_metadata():
39+
build_metadata = {"name": "aws-step-functions-data-science-sdk-python", "version": read_version(),
40+
"commit": source_version()}
41+
with open("build.json", "w") as outputfile:
42+
json.dump(build_metadata, outputfile)
43+
3144

3245
# Declare minimal set for installation
3346
required_packages = [

0 commit comments

Comments
 (0)