lanl/qmasm

Recorded plist has different files than the ones installed

yurivict opened this issue · 4 comments

The FreeBSD package builder uses the --record {plist-file} command to record the plist. The recorded plist differs from the actually installed files:

===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: bin/qb2qmasm
Error: Orphaned: bin/qmasm
Error: Orphaned: bin/qmasm-ground-state
Error: Orphaned: bin/qmasm-qbsolv
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: bin/qb2qmasm.py
Error: Missing: bin/qmasm-ground-state.py
Error: Missing: bin/qmasm-qbsolv.py
Error: Missing: bin/qmasm.py
===> Error: Plist issues found.

As I don't use FreeBSD, I can use your help in correcting this. Is there some change I should make to QMASM's setup.py file to pacify FreeBSD's package builder?

If you could you send me a pull request, that would be great.

You can run python setup.py install --record plist.txt and observe that the files there aren't the same that are installed.

Yes, that does provide the information. Clearly, it's due to my executable scripts being distributed as filename.py but installed as just filename. How should I fix my setup script to handle this case?

  1. Rename and move files: qmasm.py->scripts/qmasm, qb2qmasm.py->scripts/qb2qmasm, etc. in your repository.
  2. Apply this patch:
--- setup.py.orig       2019-06-10 22:36:49 UTC
+++ setup.py
@@ -15,10 +15,6 @@ class install(_install):
     def run(self):
         # Install, then remove <script>.py, keeping only <script>.
         _install.run(self)
-        for scr in script_list:
-            pyscript = os.path.join(self.install_scripts, scr + ".py")
-            script = os.path.join(self.install_scripts, scr)
-            os.rename(pyscript, script)
 
 setup(name = "QMASM",
       version = "3.0",
@@ -30,6 +26,6 @@ setup(name = "QMASM",
       license = "BSD",
       keywords = "quantum assembler d-wave",
       packages = find_packages(),
-      scripts = [s + ".py" for s in script_list],
+      scripts = ["scripts/"+s for s in script_list],
       cmdclass = {"install": install}
 )