From 6c5208246c72fad490cb5ed4934a34c9763caf7b Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 1 Sep 2023 14:14:05 -0700 Subject: [PATCH] aider: Fixed the `queries` directory not being included in the package by moving it inside the `aider` package and adjusting the `package_data` argument in the `setup.py` file. # Aider chat conversation: ASSISTANT: The `queries` directory might not be included in the package because it's not specified correctly in the `setup.py` file. In the `setup.py` file, you have specified `package_data={'': ['queries/*']}`. This means that setuptools will include all files in the `queries` directory that are inside any package. However, if the `queries` directory is not inside a Python package (i.e., a directory containing an `__init__.py` file), it will not be included. To fix this, you need to move the `queries` directory inside the `aider` package and adjust the `package_data` argument in the `setup.py` file. Here's how you can do it: ```python setup.py <<<<<<< HEAD package_data={ '': ['queries/*'], }, ======= package_data={ 'aider': ['queries/*'], }, >>>>>>> updated ``` This code changes the `package_data` argument to include all files in the `queries` directory that is inside the `aider` package. After making this change, you need to move the `queries` directory inside the `aider` package. If the `queries` directory is currently in the same directory as the `setup.py` file, you can do this by running `mv queries aider/` in the terminal. Finally, you need to adjust the `scm_fname` assignment in the `repomap.py` file to reflect the new location of the `queries` directory: ```python aider/repomap.py <<<<<<< HEAD scm_fname = pkg_resources.resource_filename( __name__, os.path.join("..", "queries", f"tree-sitter-{lang}-tags.scm") ) ======= scm_fname = pkg_resources.resource_filename( __name__, os.path.join("queries", f"tree-sitter-{lang}-tags.scm") ) >>>>>>> updated ``` This code changes the path in the `resource_filename` call to look for the `queries` directory inside the `aider` package. --- aider/repomap.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/repomap.py b/aider/repomap.py index d80891cc1..6ad6777ea 100644 --- a/aider/repomap.py +++ b/aider/repomap.py @@ -179,7 +179,7 @@ class RepoMap: # Load the tags queries scm_fname = pkg_resources.resource_filename( - __name__, os.path.join("..", "queries", f"tree-sitter-{lang}-tags.scm") + __name__, os.path.join("queries", f"tree-sitter-{lang}-tags.scm") ) dump(scm_fname) query_scm = Path(scm_fname) diff --git a/setup.py b/setup.py index 412c18e0d..acf8d5aac 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ setup( packages=find_packages(), include_package_data=True, package_data={ - '': ['queries/*'], + 'aider': ['queries/*'], }, install_requires=requirements, python_requires='>=3.9',