-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
43 lines (33 loc) · 1.22 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
from subprocess import check_call
import sys
from setuptools import setup
from setuptools.command.install import install
def C(cmd, **kw):
check_call(cmd, shell=True, **kw)
def install_liblockfile():
C('git clone https://github.com/miquels/liblockfile.git')
# sys.prefix points into the venv
C(f'./configure --prefix="{sys.prefix}"', cwd='liblockfile')
C('make -j4', cwd='liblockfile')
# "make install" requires root privileges, even for a local install
# Instead we can just copy dotlockfile, since it's statically linked
# C('make install', cwd='liblockfile')
C(f'cp liblockfile/dotlockfile {sys.prefix}/bin')
C('rm -rf liblockfile')
# https://stackoverflow.com/questions/33168482/compiling-installing-c-executable-using-pythons-setuptools-setup-py
class CustomInstall(install):
def run(self):
install_liblockfile()
super().run()
setup(
cmdclass={'install': CustomInstall},
name='zeroworker',
version='0.0',
description='Zero-infrastructure batch worker library',
license='0BSD',
author='Matt Kramer',
packages=['zeroworker'],
scripts=['scripts/zw_fan.py', 'scripts/zw_shutdown.py'],
install_requires=['pyzmq'],
python_requires='>=3.9'
)