-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
executable file
·91 lines (80 loc) · 3.15 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#/usr/bin/env python3
import distutils.log
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from setuptools.command.install import install
# ---------------------------------------------------------------------------
class PostProcess(install):
def run(self):
install.run(self)
# import pkg_resources
#DATA_PATH = pkg_resources.resource_filename('<package name>', 'data/')
#DB_FILE = pkg_resources.resource_filename('<package name>', 'data/sqlite.db')
# PyCN stuff: add symbolic links
dump_exe_files = []
home_bin_dir = None
for fn in self.get_outputs():
ht = os.path.split(fn)
if not home_bin_dir and ht[1] == 'cli.py':
home_bin_dir = os.path.split(ht[0])[0] + '/bin/'
if os.path.split(ht[0])[1] == 'bin':
dump_exe_files.append(fn)
self.announce('creating directory ' + home_bin_dir,
level = distutils.log.INFO)
try:
os.mkdir(home_bin_dir)
except:
pass
for fn in dump_exe_files:
self.announce('moving %s to %s' % (fn, home_bin_dir),
level = distutils.log.INFO)
os.rename(fn, home_bin_dir + '/' + os.path.split(fn)[1])
for i in ['fetch.py', 'repo_ls.py', 'repo_put.py']:
fn = home_bin_dir + i
self.announce('creating link %s -> %s' % (fn, '../client/cli.py'),
level = distutils.log.INFO)
try:
os.remove(fn)
except:
pass
os.symlink('../client/cli.py', fn)
for i in ['srv_fwd.py', 'srv_fwdrepo.py', 'src_repo.py']:
fn = home_bin_dir + i
self.announce('creating link %s -> %s' % (fn, '../server/cli.py'),
level = distutils.log.INFO)
try:
os.remove(fn)
except:
pass
os.symlink('../server/cli.py', fn)
# ---------------------------------------------------------------------------
setup(name = 'PyCN-lite',
description = 'A lightweight implementation of the two '\
'ICN protocols NDN and CCNx which also runs '\
'under Micropython v1.9.3 for IoT devices ' \
'like the ESP8266',
version = '0.1.0',
author = 'Christian Tschudin',
download_url = 'https://github.com/cn-uofbasel/PyCN-lite',
python_requires = '>=3.0',
packages = [
'pycn_lite.client',
'pycn_lite.lib',
'pycn_lite.lib.suite',
'pycn_lite.server'
],
# package_data={
# 'bin' : ['bin/dump_*.py'],
#},
platforms = ['UNIX', 'POSIX', 'BSD', 'MacOS 10.X', 'Linux',
'Micropython'],
license = 'BSD 3-clause',
data_files = [('bin', ['pycn_lite/bin/dump_ndn2013.py',
'pycn_lite/bin/dump_ccnx2015.py'])],
# cmdclass = { 'build': my_build },
cmdclass = { 'install': PostProcess}
)
# eof