setup.py (2389B)
1 import os 2 from distutils.core import setup, Extension 3 4 #swarm_dir = "/home/lash/src/home/libswarm-ng" 5 root_dir = os.path.dirname(os.path.realpath(__file__)) 6 default_swarm_dir = os.path.join(root_dir, 'aux', 'libswarm-ng') 7 swarm_dir = os.environ.get('LIBSWARM_DIR', default_swarm_dir) 8 9 requirements = [] 10 f = open('requirements.txt', 'r') 11 while True: 12 l = f.readline() 13 if l == '': 14 break 15 requirements.append(l.rstrip()) 16 f.close() 17 18 19 def main(): 20 setup( 21 name="swarm", 22 version="0.0.1a2", 23 description="Swarm tooling", 24 author="Louis Holbrook", 25 author_email="dev@holbrook.no", 26 install_requires=requirements, 27 packages=[ 28 'pylibswarm', 29 'pylibswarm.runnable', 30 ], 31 ext_modules=[ 32 Extension("swarm", [ 33 "src/python_swarm.c", 34 os.path.join(swarm_dir, 'src/bmt.c'), 35 os.path.join(swarm_dir, 'src/endian.c'), 36 os.path.join(swarm_dir, 'src/swarmfile.c'), 37 os.path.join(swarm_dir, 'src/chunk.c'), 38 os.path.join(swarm_dir, 'src/keystore.c'), 39 os.path.join(swarm_dir, 'src/soc.c'), 40 os.path.join(swarm_dir, 'src/swarm.c'), 41 os.path.join(swarm_dir, 'aux/keccak-tiny/keccak-tiny.c'), 42 ], 43 include_dirs=[ 44 os.path.join(swarm_dir, 'src'), 45 os.path.join(swarm_dir, 'aux/keccak-tiny'), 46 os.path.join(swarm_dir, 'aux/secp256k1/include'), 47 ], 48 library_dirs=[ 49 os.path.join(swarm_dir, 'aux/secp256k1/.libs'), 50 ], 51 runtime_library_dirs=[ 52 os.path.join(swarm_dir, 'aux/secp256k1/.libs'), 53 ], 54 libraries=[ 55 'secp256k1', 56 ], 57 extra_compile_args=[ 58 '-Dmemset_s(W,WL,V,OL)=memset(W,V,OL)', 59 ], 60 ), 61 ], 62 entry_points = { 63 'console_scripts': [ 64 'swarm-bmt=pylibswarm.runnable.bmt:main', 65 'swarm-file=pylibswarm.runnable.file:main', 66 'swarm-soc=pylibswarm.runnable.soc:main', 67 ], 68 }, 69 ) 70 71 if __name__ == '__main__': 72 main()