From bfa21dfe61fac458af560af943a75b4380a9b23e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 9 Nov 2023 23:15:58 +0200 Subject: [PATCH] feat: add Python wrapper package For pre-commit use. --- .gitignore | 3 +++ setup.cfg | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 352bd32..2642d63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ +/*.egg-info/ /.rtx.*.local.toml /.rtx.local.toml +/build/ /dist/ +/venv/ /wrun diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..5c2c8c1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,54 @@ +[metadata] +name = wrun_py +version = 0.0.0 +description = Python wrapper around invoking wrun (https://github.com/scop/wrun) +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/scop/wrun +author = Ville Skyttä +author_email = ville.skytta@iki.fi +license = Apache License 2.0 +license_files = LICENSE +classifiers = + License :: OSI Approved :: MIT License + Programming Language :: Python :: 3 + +[options] +python_requires = >=3.8 +setup_requires = + setuptools-download + +[setuptools_download] +download_scripts = + [wrun] + group = wrun-binary + marker = sys_platform == "darwin" and platform_machine == "x86_64" + url = https://github.com/scop/wrun/releases/download/v0.0.0/wrun_0.0.0_darwin_amd64 + sha256 = 772655db56fe81d423a13c65300ef6aab53d27dc5361cb116af6876f0689527e + [wrun] + group = wrun-binary + marker = sys_platform == "darwin" and platform_machine == "arm64" + url = https://github.com/scop/wrun/releases/download/v0.0.0/wrun_0.0.0_darwin_arm64 + sha256 = 2e1913cf4a226ff378c89a1820326eb8751b1595a6f7425529502b473c2c6d19 + [wrun] + group = wrun-binary + marker = sys_platform == "linux" and platform_machine == "x86_64" + url = https://github.com/scop/wrun/releases/download/v0.0.0/wrun_0.0.0_linux_amd64 + sha256 = 62205a2c1a131522a8b423b8b46c121d596b1a7c02ff56ddb7a008783f69be63 + [wrun] + group = wrun-binary + marker = sys_platform == "linux" and platform_machine == "aarch64" + url = https://github.com/scop/wrun/releases/download/v0.0.0/wrun_0.0.0_linux_arm64 + sha256 = 4e57aa96df0ddb93977a4f37ec1a83161534765d3a37c6f0863fdacc723cd29a + [wrun] + group = wrun-binary + marker = sys_platform == "linux" and platform_machine == "armv6hf" + marker = sys_platform == "linux" and platform_machine == "armv7l" + url = https://github.com/scop/wrun/releases/download/v0.0.0/wrun_0.0.0_linux_armv6 + sha256 = fe52f9f442c2fd7a77f67cd2ae4672d06a99b6bc2d3a2e4e74f5702512251b24 + [wrun.exe] + group = wrun-binary + marker = sys_platform == "win32" and platform_machine == "AMD64" + marker = sys_platform == "cygwin" and platform_machine == "x86_64" + url = https://github.com/scop/wrun/releases/download/v0.0.0/wrun_0.0.0_windows_amd64.exe + sha256 = d7f45655cb2fdf747d13eea4f8db9662a1c87d579aa37e0c0530689f215d1ac7 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..2ec6da7 --- /dev/null +++ b/setup.py @@ -0,0 +1,45 @@ +# Copyright (c) 2019 Ryan Rhee +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Copied from https://github.com/shellcheck-py/shellcheck-py/tree/v0.9.0.6 +# SPDX-License-Identifier: MIT + +from setuptools import setup + +try: + from wheel.bdist_wheel import bdist_wheel as orig_bdist_wheel +except ImportError: + cmdclass = {} +else: + + class bdist_wheel(orig_bdist_wheel): + def finalize_options(self): + orig_bdist_wheel.finalize_options(self) + # Mark us as not a pure python package + self.root_is_pure = False + + def get_tag(self): + _, _, plat = orig_bdist_wheel.get_tag(self) + # We don't contain any python source, nor any python extensions + return "py2.py3", "none", plat + + cmdclass = {"bdist_wheel": bdist_wheel} + +setup(cmdclass=cmdclass)