diff options
author | 2013-06-09 18:10:22 +0200 | |
---|---|---|
committer | 2013-06-09 18:10:23 +0200 | |
commit | 16af85004c84d0d6c626b4f8424ce9647669a0c1 (patch) | |
tree | 025d479862d376dbc17e934f4ed20031c8cd97d1 /pyload/remote/create_jstypes.py | |
parent | adapted to jshint config (diff) | |
download | pyload-16af85004c84d0d6c626b4f8424ce9647669a0c1.tar.xz |
moved everything from module to pyload
Diffstat (limited to 'pyload/remote/create_jstypes.py')
-rw-r--r-- | pyload/remote/create_jstypes.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pyload/remote/create_jstypes.py b/pyload/remote/create_jstypes.py new file mode 100644 index 000000000..90afa4c96 --- /dev/null +++ b/pyload/remote/create_jstypes.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from os.path import abspath, dirname, join + +path = dirname(abspath(__file__)) +module = join(path, "..") + +import apitypes +from apitypes_debug import enums + +# generate js enums +def main(): + + print "generating apitypes.js" + + f = open(join(module, 'web', 'app', 'scripts', 'utils', 'apitypes.js'), 'wb') + f.write("""// Autogenerated, do not edit! +/*jslint -W070: false*/ +define([], function() { +\t'use strict'; +\treturn { +""") + + for name in enums: + enum = getattr(apitypes, name) + values = dict([(attr, getattr(enum, attr)) for attr in dir(enum) if not attr.startswith("_")]) + + f.write("\t\t%s: %s,\n" % (name, str(values))) + + f.write("\t};\n});") + f.close() + + +if __name__ == "__main__": + main() |