Skip to content

pip installed tool fails #292

@jayvdb

Description

@jayvdb

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions