stronger autopep8 whitespace cleanup
[pinmux.git] / src / pinmux_generator.py
index 8d36f1c113a4ebb80d69b68cb11f0d6596d2ec50..6b8452590082b55fcaad1b2e2bc28102967498a0 100644 (file)
@@ -26,7 +26,8 @@ from bsv.pinmux_generator import pinmuxgen as bsvgen
 
 def printhelp():
     print ('''pinmux_generator.py [-o outputdir] [-v|--validate] [-h|--help]
-                                  [-t outputtype]
+                                  [-t outputtype] [-s|--spec spec]
+    -s | spec       : generate from spec (python module)
     -t | outputtype : outputtype, defaults to bsv
     -o outputdir    : defaults to bsv_src.  also location for reading pinmux.txt
                       interfaces.txt and *.txt
@@ -56,6 +57,7 @@ if __name__ == '__main__':
     output_dir = None
     validate = False
     spec = None
+    pinspec = None
     for opt, arg in options:
         if opt in ('-o', '--output'):
             output_dir = arg
@@ -70,7 +72,7 @@ if __name__ == '__main__':
             sys.exit(0)
 
     if pinspec:
-        if not modules.has_key(pinspec):
+        if pinspec not in modules:
             print "ERROR: spec type '%s' does not exist" % pinspec
             printhelp()
             sys.exit(1)
@@ -79,7 +81,7 @@ if __name__ == '__main__':
         specgen(output_dir, pinout, bankspec, fixedpins)
     else:
         gentypes = {'bsv': bsvgen}
-        if not gentypes.has_key(output_type):
+        if output_type not in gentypes:
             print "ERROR: output type '%s' does not exist" % output_type
             printhelp()
             sys.exit(0)