Mercurial > hg > config
annotate python/s5ify.py @ 761:9e4a21ca48af
add a front end to rst2s5; stub
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 04 Jan 2016 12:54:51 -0800 |
parents | |
children | 1758ead4ad2f |
rev | line source |
---|---|
761
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
2 |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
3 """ |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
4 my front end to rst2st.py |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
5 """ |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
6 |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
7 # imports |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
8 import argparse |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
9 import os |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
10 import subprocess |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
11 import sys |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
12 |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
13 def normalize_filename(filename): |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
14 return None # TODO |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
15 |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
16 def main(args=sys.argv[1:]): |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
17 """CLI""" |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
18 |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
19 # parse command line |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
20 parser = argparse.ArgumentParser(description=__doc__) |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
21 parser.add_option('input') |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
22 options = parser.parse_parse(args) |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
23 |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
24 # sanity |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
25 input = options.input |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
26 if not os.path.isfile(input) |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
27 parser.error("Not a file: '{}'".format(input)) |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
28 input = os.path.abspath(options.input) |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
29 |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
30 if __name__ == '__main__': |
9e4a21ca48af
add a front end to rst2s5; stub
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
31 main() |