rpm-software-management / spec-cleaner

spec-cleaner
BSD 3-Clause "New" or "Revised" License
27 stars 33 forks source link

pip installed tool fails #292

Open jayvdb opened 2 years ago

jayvdb commented 2 years ago

The package doesnt include the /data needed by the app.

On OSX I get

spec-cleaner -i *.spec
ERROR: File 'excludes-bracketing.txt' not found in datadirs
Exception ignored in: <function RpmSpecCleaner.__del__ at 0x10ab28d30>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/spec_cleaner/rpmcleaner.py", line 424, in __del__
    if self.fin:
AttributeError: 'RpmSpecCleaner' object has no attribute 'fin'

IMO the fix is to include the data dir into the package, and put at lower priority than distro packages, e.g.

diff --git a/spec_cleaner/fileutils.py b/spec_cleaner/fileutils.py
index 4e17cd8..d7d50a2 100644
--- a/spec_cleaner/fileutils.py
+++ b/spec_cleaner/fileutils.py
@@ -28,6 +28,7 @@ def open_datafile(name: str) -> IO[str]:
         '{0}/share/spec-cleaner/{1}'.format(homedir, name),
         '{0}/share/spec-cleaner/{1}'.format(sysconfig.get_path('data'), name),
         '{0}/share/spec-cleaner/{1}'.format(sys.prefix, name),
+        '{0}/data/{1}'.format(os.path.dirname(os.path.realpath(__file__)), name),
     )

     for path in possible_paths:
mcepl commented 1 year ago

??? Wouldn’t it be better just to package data/?