Skip to content
Snippets Groups Projects

setup.py: Install swh_ql.so alongside .py files, so it can be seen by pkg_resources

Like this:

ql_rel_paths = [
    "swh_ql.so",  # installed
    "../../query_language/swh_ql.so",  # development
]
for ql_rel_path in ql_rel_paths:
    ql_path = resource_filename("swh.search", ql_rel_path)
    if os.path.exists(ql_path):
        break
else:
    assert False, 'not found'

search_ql = Language(ql_path, "swh_search_ql")

data_files is not designed to be accessed from the same Python package, but to write files in standard locations (typically .desktop files in /usr/share) that other packages read with their own discovery mechanisms.


Migrated from D6039 (view on Phabricator)

Merge request reports

Approved by

Closed by Phabricator Migration userPhabricator Migration user 3 years ago (Jul 29, 2021 7:47am UTC)

Merge details

  • The changes were not merged into generated-differential-D6039-target.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Build is green

    Patch application report for D6039 (id=21834)

    Rebasing onto 5f786a5c...

    Current branch diff-target is up to date.
    Changes applied before test
    commit c34011b7c7621e872f96c5625543228324085133
    Author: Valentin Lorentz <vlorentz@softwareheritage.org>
    Date:   Wed Jul 28 15:08:29 2021 +0200
    
        setup.py: Install swh_ql.so alongside .py files, so it can be seen by pkg_resources
        
        Like this:
        
        ```
        ql_rel_paths = [
            "swh_ql.so",  # installed
            "../../query_language/swh_ql.so",  # development
        ]
        for ql_rel_path in ql_rel_paths:
            ql_path = resource_filename("swh.search", ql_rel_path)
            if os.path.exists(ql_path):
                break
        else:
            assert False, 'not found'
        
        search_ql = Language(ql_path, "swh_search_ql")
        ```
        
        `data_files` is not designed to be accessed from the same Python
        package, but to write files in standard locations (typically
        `.desktop` files in /usr/share) that other packages read with
        their own discovery mechanisms.

    See https://jenkins.softwareheritage.org/job/DSEA/job/tests-on-diff/242/ for more details.

  • Merge request was accepted

  • Kumar Shivendu approved this merge request

    approved this merge request

  • Author Maintainer

    Merge request was merged

  • closed

Please register or sign in to reply
Loading