File: install.py

package info (click to toggle)
pylize 1.3b-6
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 344 kB
  • ctags: 139
  • sloc: python: 935; makefile: 63
file content (54 lines) | stat: -rwxr-xr-x 1,662 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python

import os, sys

py_ver = "%i.%i" % sys.version_info[:2]

sys.stderr.write("Cleaning generated files...\n")
ret = os.system('python setup.py clean')
if ret == 0:
    sys.stderr.write("Running 'configure.py'...\n")
    ret = os.system('python configure.py %s' % (" ".join(sys.argv[1:]),))
if ret != 0:
    sys.stderr.write("Failed!")
    sys.exit(1)

sys.stderr.write("Running 'setup.py build'...\n")
ret = os.system('python setup.py build')
if ret != 0:
    sys.stderr.write("Failed!")
    sys.exit(1)

scripts1 = os.path.join('build', 'scripts')
scripts2 = os.path.join('build', 'scripts-%s' % py_ver)
if not os.path.exists(scripts2) or (os.path.exists(scripts1) and
  os.stat(scripts1)[8] > os.stat(scripts2)[8]):
    if os.path.exists(scripts2):
       try:
           import shutils
           shutils.rmtree(scripts2)
       except: pass
    try:
        os.symlink('scripts', scripts2)
    except:
        os.rename(scripts1, scripts2)
pylize_script=os.path.join(os.pardir, scripts2, 'pylize')
libdir = os.path.join(os.pardir, 'lib')

sys.stderr.write("Making documentation...\n")
os.chdir('doc')
cmd = 'python "%s" -s -L "%s"' % (pylize_script, libdir)
print cmd
ret = os.system(cmd)
os.chdir(os.pardir)
if ret != 0:
    sys.stderr.write("Failed. Re-check the installation.\n")
    sys.exit(1)
    sys.stderr.write("Ok. Open 'doc/index.html' in your browser to view the documentation.\n")

sys.stderr.write("Running 'setup.py install'...\n")
ret = os.system('python setup.py install')

if ret != 0:
   sys.stderr.write("""### Failed. #### Perhaps you have to be root to install.
Run: su -c "python%s setup.py install"\n""" % py_ver)