Skip to content

Commit 7c36700

Browse files
reformat setup.py
1 parent 3c92d79 commit 7c36700

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

setup.py

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,55 +20,66 @@
2020
from subprocess import Popen, PIPE
2121

2222
DIR = os.path.abspath(os.path.dirname(__file__))
23-
LIB_DIR = DIR + '/c-bindings'
24-
MODULE_SOURCES = ['python/_jsonnet.c']
23+
LIB_DIR = DIR + "/c-bindings"
24+
MODULE_SOURCES = ["python/_jsonnet.c"]
25+
2526

2627
def get_version():
2728
"""
2829
Parses the version out of vm.go
2930
"""
30-
with open(os.path.join(DIR, 'vm.go')) as f:
31+
with open(os.path.join(DIR, "vm.go")) as f:
3132
for line in f:
32-
if 'const' in line and 'version' in line:
33-
v_code = line.partition('=')[2].strip('\n "')
34-
if v_code[0] == 'v':
33+
if "const" in line and "version" in line:
34+
v_code = line.partition("=")[2].strip('\n "')
35+
if v_code[0] == "v":
3536
return v_code[1:]
3637

3738
return None
3839

40+
3941
class BuildJsonnetExt(BuildExt):
4042
def run(self):
41-
p = Popen(['go', 'build', '-o', 'libgojsonnet.a', '-buildmode=c-archive'], cwd=LIB_DIR, stdout=PIPE)
43+
p = Popen(
44+
["go", "build", "-o", "libgojsonnet.a", "-buildmode=c-archive"],
45+
cwd=LIB_DIR,
46+
stdout=PIPE,
47+
)
4248
p.wait()
4349

4450
if p.returncode != 0:
45-
raise Exception('Could not build libgojsonnet.a')
51+
raise Exception("Could not build libgojsonnet.a")
4652

4753
BuildExt.run(self)
4854

55+
4956
class NoopTestCommand(TestCommand):
5057
def __init__(self, dist):
51-
print("_gojsonnet does not support running tests with 'python setup.py test'. Please run 'pytest'.")
58+
print(
59+
"_gojsonnet does not support running tests with 'python setup.py test'. Please run 'pytest'."
60+
)
61+
5262

5363
jsonnet_ext = Extension(
54-
'_gojsonnet',
64+
"_gojsonnet",
5565
sources=MODULE_SOURCES,
5666
extra_objects=[
57-
LIB_DIR + '/libgojsonnet.a',
67+
LIB_DIR + "/libgojsonnet.a",
5868
],
59-
include_dirs = ['cpp-jsonnet/include'],
60-
language='c++',
69+
include_dirs=["cpp-jsonnet/include"],
70+
language="c++",
6171
)
6272

63-
setup(name='gojsonnet',
64-
url='https://jsonnet.org',
65-
description='Python bindings for Jsonnet - The data templating language ',
66-
author='David Cunningham',
67-
author_email='[email protected]',
73+
setup(
74+
name="gojsonnet",
75+
url="https://jsonnet.org",
76+
description="Python bindings for Jsonnet - The data templating language ",
77+
author="David Cunningham",
78+
author_email="[email protected]",
6879
version=get_version(),
6980
cmdclass={
70-
'build_ext': BuildJsonnetExt,
71-
'test': NoopTestCommand,
81+
"build_ext": BuildJsonnetExt,
82+
"test": NoopTestCommand,
7283
},
7384
ext_modules=[jsonnet_ext],
7485
)

0 commit comments

Comments
 (0)