File: update_web.py

package info (click to toggle)
allegro5 2%3A5.0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,856 kB
  • ctags: 15,948
  • sloc: ansic: 87,540; cpp: 9,693; objc: 3,491; python: 2,057; sh: 829; makefile: 93; perl: 37; pascal: 24
file content (45 lines) | stat: -rwxr-xr-x 1,420 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env python
import optparse, subprocess, sys, os

def main(argv):
    global options
    p = optparse.OptionParser()
    p.add_option("-p", "--path", help = "Path to the build directory.")
    p.add_option("-u", "--user", help = "Username to use.")
    p.add_option("-d", "--directory", help = "Remote directory to " +
        "use. Should be either 'trunk' which is the default or else " +
        "the version number.", default = "trunk")
    options, args = p.parse_args()

    if options.user:
        sf = "%s,alleg@web.sf.net" % options.user
    else:
        sys.stderr.write("SourceForge user name required (-u).\n")
        p.print_help()
        sys.exit(-1)
    
    if not options.path:
        sys.stderr.write("Build path required (-p).\n")
        p.print_help()
        sys.exit(-1)

    destdir = "/home/groups/a/al/alleg/htdocs_parts/staticweb/a5docs"
    destdir += "/" + options.directory

    def run(cmd):
        print ">", cmd
        return subprocess.call(cmd, shell = True,
            stdout = subprocess.PIPE,
            stderr = subprocess.STDOUT)

    print "Copying files.."
    rsync = "rsync --delete -r -z"
    path = os.path.join(options.path, "docs/html/refman/")
    retcode = run("%s %s %s:%s" % (rsync, path, sf, destdir))
    if retcode == 0:
	print("Updated A5 docs at: http://docs.liballeg.org")
    sys.exit(retcode)

if __name__ == "__main__":
    main(sys.argv)