forked from your-tools/pycp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
74 lines (61 loc) · 1.89 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
#!/usr/bin/env python
from distutils.core import setup
import os
import sys
import pycp
import subprocess
ON_WINDOWS = False
if sys.platform.startswith("win"):
ON_WINDOWS = True
def gen_man_pages():
"""Simply call help2man bin/pycp """
man_pages = {}
for f in ["pycp", "pymv"]:
try:
bin = os.path.join("bin", f)
p = subprocess.Popen("help2man -N %s" % bin,
stdout=subprocess.PIPE,
env = {"PYTHONPATH" : "."},
shell = True)
out = p.communicate()[0]
man_pages[f] = out
except OSError, e:
print "help2man failed. Error was", e
return
if not os.path.exists("doc"):
os.mkdir("doc")
for f in ["pycp", "pymv"]:
man = os.path.join("doc", f + ".1")
f_desc = open(man, "w")
f_desc.write(man_pages[f])
f_desc.close()
return man_pages
if not ON_WINDOWS:
scripts = ["bin/pycp", "bin/pymv"]
man_pages = gen_man_pages()
if man_pages:
data_files = [("/usr/share/man/man1", ["doc/pycp.1","doc/pymv.1"])]
else:
data_files = []
else:
scripts = [r"bin\pycp.bat", r"bin\pymv.bat"]
data_files = []
setup(name='pycp',
version = pycp.__version__,
description = 'cp with a progressbar',
long_description = pycp.__doc__,
author = pycp.__author__,
author_email = pycp.__author_email__,
url = 'http://github.com/yannicklm/pycp',
packages = ['pycp'],
license ='COPYING',
scripts = scripts,
data_files = data_files,
classifiers = [
"Environment :: Console",
"License :: OSI Approved :: BSD License",
"Operating System :: Unix",
"Programming Language :: Python :: 2 :: Only",
"Topic :: System :: Shells",
],
)