Changeset View
Changeset View
Standalone View
Standalone View
setup.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | |||||||||||
# Copyright (C) 2015-2020 The Software Heritage developers | # Copyright (C) 2015-2020 The Software Heritage developers | |||||||||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | |||||||||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | |||||||||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | |||||||||||
from distutils.command.build_py import build_py | ||||||||||||
from io import open | from io import open | |||||||||||
from os import path | from os import environ, path, system | |||||||||||
from setuptools import find_packages, setup | from setuptools import find_packages, setup | |||||||||||
vlorentz: why this change? | ||||||||||||
Done Inline ActionsWhen I run mypy . in swh-search What should be the version of mypy? KShivendu: When I run `mypy .` in `swh-search`
I get `setup.py:11: error: Skipping analyzing "setuptools"… | ||||||||||||
Not Done Inline ActionsAdd types-setuptools in requirements-test.txt anlambert: Add `types-setuptools` in `requirements-test.txt` | ||||||||||||
here = path.abspath(path.dirname(__file__)) | here = path.abspath(path.dirname(__file__)) | |||||||||||
# Get the long description from the README file | # Get the long description from the README file | |||||||||||
with open(path.join(here, "README.md"), encoding="utf-8") as f: | with open(path.join(here, "README.md"), encoding="utf-8") as f: | |||||||||||
long_description = f.read() | long_description = f.read() | |||||||||||
Show All 11 Lines | with open(reqf) as f: | |||||||||||
for line in f.readlines(): | for line in f.readlines(): | |||||||||||
line = line.strip() | line = line.strip() | |||||||||||
if not line or line.startswith("#"): | if not line or line.startswith("#"): | |||||||||||
continue | continue | |||||||||||
requirements.append(line) | requirements.append(line) | |||||||||||
return requirements | return requirements | |||||||||||
class custom_build(build_py): | ||||||||||||
def run(self): | ||||||||||||
if not self.dry_run: | ||||||||||||
yarn = environ.get("YARN", "yarn") | ||||||||||||
Done Inline ActionsIs it okay to do it this way? KShivendu: Is it okay to do it this way? | ||||||||||||
Not Done Inline ActionsPlease make the command configurable (like it is in the Makefile); yarn is also the name of an unrelated executable (https://packages.debian.org/buster/cmdtest) vlorentz: Please make the command configurable (like it is in the `Makefile`); `yarn` is also the name of… | ||||||||||||
Not Done Inline ActionsDo you mean :
or something else? KShivendu: Do you mean :
1. something like `python setup.py parser` should do `yarn install && yarn… | ||||||||||||
Not Done Inline ActionsI mean something like this: yarn = os.environ.get("YARN", "yarn") subprocess.check_run([yarn, "install"]) subprocess.check_run([yarn, "generate"]) vlorentz: I mean something like this:
```
yarn = os.environ.get("YARN", "yarn")
subprocess.check_run… | ||||||||||||
system(f"{yarn} install") | ||||||||||||
system(f"{yarn} build-so && echo 'swh_ql.so file generated'") | ||||||||||||
system(f"{yarn} build-wasm && echo 'swh_ql.wasm file generated'") | ||||||||||||
system("echo 'static files generated. moving them to static/ dir'") | ||||||||||||
system("mkdir static") | ||||||||||||
system("mv query_language/swh_ql.so static/swh_ql.so") | ||||||||||||
system("mv query_language/swh_ql.wasm static/swh_ql.wasm") | ||||||||||||
build_py.run(self) | ||||||||||||
setup( | setup( | |||||||||||
name="swh.search", | name="swh.search", | |||||||||||
description="Software Heritage search service", | description="Software Heritage search service", | |||||||||||
long_description=long_description, | long_description=long_description, | |||||||||||
long_description_content_type="text/markdown", | long_description_content_type="text/markdown", | |||||||||||
python_requires=">=3.7", | python_requires=">=3.7", | |||||||||||
author="Software Heritage developers", | author="Software Heritage developers", | |||||||||||
author_email="swh-devel@inria.fr", | author_email="swh-devel@inria.fr", | |||||||||||
Show All 17 Lines | classifiers=[ | |||||||||||
"Development Status :: 3 - Alpha", | "Development Status :: 3 - Alpha", | |||||||||||
], | ], | |||||||||||
project_urls={ | project_urls={ | |||||||||||
"Bug Reports": "https://forge.softwareheritage.org/maniphest", | "Bug Reports": "https://forge.softwareheritage.org/maniphest", | |||||||||||
"Funding": "https://www.softwareheritage.org/donate", | "Funding": "https://www.softwareheritage.org/donate", | |||||||||||
"Source": "https://forge.softwareheritage.org/source/swh-search", | "Source": "https://forge.softwareheritage.org/source/swh-search", | |||||||||||
"Documentation": "https://docs.softwareheritage.org/devel/swh-search/", | "Documentation": "https://docs.softwareheritage.org/devel/swh-search/", | |||||||||||
}, | }, | |||||||||||
cmdclass={"build_py": custom_build}, | ||||||||||||
Not Done Inline ActionsCan you bundle the wasm module too ? swh-web will need it to use the search language parser. anlambert: Can you bundle the wasm module too ? `swh-web` will need it to use the search language parser. | ||||||||||||
Not Done Inline Actionsftr, swh-web puts its static files in share/swh/web, same kind of path should be used here too imho. anlambert: ftr, `swh-web` puts its static files in `share/swh/web`, same kind of path should be used here… | ||||||||||||
data_files=[("share/swh/search", ["static/swh_ql.so", "static/swh_ql.wasm"])], | ||||||||||||
) | ) | |||||||||||
Not Done Inline Actions
vlorentz: |
why this change?