forked from iipeace/guider
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
65 lines (52 loc) · 1.71 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
import site, os
from distutils.core import setup
setup(
name = 'guider',
version = '3.9.3',
license = 'GPL2',
description = 'A system-wide analyzer of performance',
author = 'Peace Lee',
author_email = '[email protected]',
url = 'https://github.com/iipeace/guider',
download_url = 'https://github.com/iipeace/guider/archive/master.zip',
keywords = ['guider', 'linux', 'analyzer', 'performance', 'profile', 'trace', 'kernel'],
packages = ['guider'],
data_files=[('/usr/sbin', ['guider/guider'])],
classifiers = [],
)
try:
os.mkdir('/usr/share/guider')
except:
pass
for path in site.getsitepackages():
pycPath = '/usr/share/guider/guider.pyc'
pycOrig = '%s/guider/guider.pyc' % path
cachedPycDir = '%s/guider/__pycache__/' % path
if os.path.isdir(cachedPycDir):
for cache in os.listdir(cachedPycDir):
os.rename('%s%s' % (cachedPycDir, cache), pycOrig)
try:
pycOrig = '%s/guider/guider.pyc' % path
if os.path.isfile(pycOrig) is False:
continue
if os.path.isfile(pycPath):
os.unlink(pycPath)
cachedPycDir = '%s/guider/__pycache__/' % path
if os.path.isdir(cachedPycDir):
for cache in os.listdir(cachedPycDir):
os.rename('%s%s' % (cachedPycDir, cache), pycOrig)
os.symlink(pycOrig, pycPath)
except:
pass
try:
shPath = '/usr/sbin/guider'
if os.isfile(shPath):
os.remove(shPath)
os.symlink('%s/guider/usr/sbin/guider' % path, shPath)
except:
pass
'''
upload command
# python setup.py sdist upload -r pypitest
# python setup.py sdist upload -r https://upload.pypi.org/legacy/
'''