-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
17 changed files
with
848 additions
and
649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
exclude: testing/baselines | ||
- id: end-of-file-fixer | ||
exclude: testing/baselines | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
rev: 23.1a1 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.3.1 | ||
hooks: | ||
- id: pyupgrade | ||
args: ["--py37-plus"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,66 +7,67 @@ | |
|
||
class BinaryDistribution(Distribution): | ||
"""Distribution which always forces a binary package with platform name""" | ||
|
||
# https://stackoverflow.com/a/62668026 | ||
def has_ext_modules(self): | ||
return True | ||
|
||
|
||
class InstallPlatlib(install): | ||
"""Additional tweak to treat the package as platform-specific.""" | ||
|
||
# https://github.com/google/or-tools/issues/616#issuecomment-371480314 | ||
def finalize_options(self): | ||
install.finalize_options(self) | ||
self.install_lib = self.install_platlib | ||
|
||
|
||
class BuildCommand(setuptools.command.build_py.build_py): | ||
"""A customized build command that also rebuilds the parser bindings as needed.""" | ||
|
||
def run(self): | ||
self.refresh_bindings() | ||
super().run() # Run regular build procedure | ||
super().run() # Run regular build procedure | ||
|
||
def refresh_bindings(self): | ||
try: | ||
import tree_sitter | ||
except ImportError: | ||
print('Warning: tree_sitter module not found, not refreshing bindings') | ||
print("Warning: tree_sitter module not found, not refreshing bindings") | ||
return | ||
|
||
# Recompile the tree-sitter bindings. This is a no-op when the parser | ||
# needs no rebuild. We specify the library output path and the | ||
# tree-sitter repo path to include. | ||
tree_sitter.Language.build_library('./zeekscript/zeek-language.so', | ||
['tree-sitter-zeek']) | ||
tree_sitter.Language.build_library( | ||
"./zeekscript/zeek-language.so", ["tree-sitter-zeek"] | ||
) | ||
|
||
|
||
setup( | ||
name='zeekscript', | ||
version=open('VERSION').read().replace('-', '.dev', 1).strip(), | ||
description='A Zeek script formatter and analyzer', | ||
long_description=open('README.md').read(), | ||
long_description_content_type='text/markdown', | ||
keywords='zeek scripts language formatter formatting indenter indenting parsing', | ||
maintainer='The Zeek Project', | ||
maintainer_email='[email protected]', | ||
url='https://github.com/zeek/zeekscript', | ||
|
||
scripts=['zeek-format', 'zeek-script'], | ||
packages=['zeekscript'], | ||
package_data={'zeekscript': ['zeek-language.so']}, | ||
|
||
name="zeekscript", | ||
version=open("VERSION").read().replace("-", ".dev", 1).strip(), | ||
description="A Zeek script formatter and analyzer", | ||
long_description=open("README.md").read(), | ||
long_description_content_type="text/markdown", | ||
keywords="zeek scripts language formatter formatting indenter indenting parsing", | ||
maintainer="The Zeek Project", | ||
maintainer_email="[email protected]", | ||
url="https://github.com/zeek/zeekscript", | ||
scripts=["zeek-format", "zeek-script"], | ||
packages=["zeekscript"], | ||
package_data={"zeekscript": ["zeek-language.so"]}, | ||
cmdclass={ | ||
'build_py': BuildCommand, | ||
'install': InstallPlatlib, | ||
"build_py": BuildCommand, | ||
"install": InstallPlatlib, | ||
}, | ||
|
||
distclass=BinaryDistribution, | ||
|
||
setup_requires=['tree_sitter'], | ||
install_requires=['tree_sitter'], | ||
python_requires='>3.7.0', | ||
|
||
setup_requires=["tree_sitter"], | ||
install_requires=["tree_sitter"], | ||
python_requires=">3.7.0", | ||
classifiers=[ | ||
'Programming Language :: Python :: 3.7', | ||
'License :: OSI Approved :: BSD License', | ||
'Topic :: Utilities', | ||
"Programming Language :: Python :: 3.7", | ||
"License :: OSI Approved :: BSD License", | ||
"Topic :: Utilities", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.