-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
48 lines (44 loc) · 1.45 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from setuptools import setup,find_packages
from setuptools.command.install import install
import subprocess
import os
def read_requirements(filename="requirements.txt"):
with open(filename, "r") as f:
return [line.strip() for line in f if line and not line.startswith("#")]
class GoBuildCommand(install):
def run(self):
print("Installing go package")
# Run the Go build process
if subprocess.call(['go', 'version']) != 0:
raise RuntimeError("Go is not installed or not found in the PATH")
result = subprocess.run(
['go', 'build', '-o', 'rpm_checker', 'main.go'],
cwd=os.getcwd() + "/orca/rpm_checker",
capture_output=True,
text=True
)
if result.returncode != 0:
raise RuntimeError(
f"Could not install rpm_checker. Current path: {os.getcwd()} - {os.listdir()}\n"
f"stdout: {result.stdout}\n"
f"stderr: {result.stderr}"
)
else:
print(f"rpm_checker installed at {os.getcwd()}")
print("Complete installation")
super().run()
setup(
name='orca',
version='0.1.14',
packages=find_packages(),
install_requires=read_requirements(),
cmdclass={
'install': GoBuildCommand,
},
entry_points={
'console_scripts': [
'orca=orca.main:main',
],
},
include_package_data=True,
)