sorting out wiki directories
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 23 Apr 2021 13:19:12 +0000 (14:19 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 23 Apr 2021 13:19:12 +0000 (14:19 +0100)
setup.py
src/openpower/decoder/power_enums.py
src/openpower/decoder/pseudo/pywriter.py

index d2b0216dc8399468af7beb63887a0cc471bed6df..00ff7597322a6a9c137d932ceed4faa337886310 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -48,4 +48,9 @@ setup(
     install_requires=install_requires,
     tests_require=test_requires,
     test_suite='nose.collector',
+    entry_points = {
+        'console_scripts': [
+            'pywriter=openpower.decoder.pseudo.pywriter:pywriter'
+        ]
+    }
 )
index 3353d202526ee2a885fd645282ab5b94c7320ef5..5a29e8f162584f122ec8aa2a618e1c342e158a72 100644 (file)
@@ -24,18 +24,13 @@ from collections import namedtuple
 def find_wiki_dir():
     filedir = os.path.dirname(os.path.abspath(__file__))
     basedir = dirname(dirname(dirname(filedir)))
-    tabledir = join(basedir, 'libreriscv')
-    tabledir = join(tabledir, 'openpower')
-    return join(tabledir, 'isatables')
+    tabledir = join(basedir, 'openpower')
+    isatables = join(tabledir, 'isatables')
+    print ("find_wiki_dir", isatables)
+    return isatables
 
 
 def find_wiki_file(name):
-    filedir = os.path.dirname(os.path.abspath(__file__))
-    basedir = dirname(dirname(dirname(filedir)))
-    tabledir = join(basedir, 'libreriscv')
-    tabledir = join(tabledir, 'openpower')
-    tabledir = join(tabledir, 'isatables')
-
     return join(find_wiki_dir(), name)
 
 
index 77ff775ebd815c2ac121318109d64cfd02b4ad7a..355d8ae5ba1fbc8485f918921258aa98b474cc25 100644 (file)
@@ -4,10 +4,10 @@ import os
 import sys
 import shutil
 import subprocess
-from soc.decoder.pseudo.pagereader import ISA
-from soc.decoder.power_pseudo import convert_to_python
-from soc.decoder.orderedset import OrderedSet
-from soc.decoder.isa.caller import create_args
+from openpower.decoder.pseudo.pagereader import ISA
+from openpower.decoder.power_pseudo import convert_to_python
+from openpower.decoder.orderedset import OrderedSet
+from openpower.decoder.isa.caller import create_args
 
 
 def get_isasrc_dir():
@@ -129,7 +129,7 @@ class PyISAWriter(ISA):
             f.write('        }\n')
 
 
-if __name__ == '__main__':
+def pywriter():
     isa = PyISAWriter()
     write_isa_class = True
     if len(sys.argv) == 1:  # quick way to do it
@@ -146,3 +146,6 @@ if __name__ == '__main__':
         isa.patch_if_needed(source)
     if write_isa_class:
         isa.write_isa_class()
+
+if __name__ == '__main__':
+    pywriter()