Skip to content

Commit

Permalink
🔥 Remove CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Oct 27, 2023
1 parent 4d3e819 commit 4355eb7
Show file tree
Hide file tree
Showing 33 changed files with 2,624 additions and 1,933 deletions.
2 changes: 0 additions & 2 deletions .cmake-format.yaml

This file was deleted.

1 change: 0 additions & 1 deletion .cmakelintrc

This file was deleted.

69 changes: 40 additions & 29 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,50 @@ permissions:
contents: write

env:
CMAKE_GENERATOR: Ninja
PYTHONUTF8: "1"
python-version: 3.x
cache: pip

jobs:
build-wheels-and-test:
test:
strategy:
fail-fast: false
matrix:
runs-on:
- ubuntu-latest
# Could not find a version that satisfies the requirement
# tree-sitter-languages
# No matching distribution found for tree-sitter-languages
# - ubuntu-latest
- macos-latest
# OSError: [WinError 193] %1 is not a valid Win32 application
# https://github.com/tree-sitter/py-tree-sitter/issues/170
# - windows-latest
runs-on: ${{ matrix.runs-on }}
runs-on: ${{matrix.runs-on}}
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2.2.0
if: runner.os == 'Linux'
- uses: pypa/cibuildwheel@v2.14.1
- uses: actions/upload-artifact@v3
- uses: actions/setup-python@v4
with:
path: |
wheelhouse/*.whl
python-version: ${{env.python-version}}
cache: ${{env.cache}}
cache-dependency-path: |-
requirements.txt
requirements/dev.txt
- name: Install dependencies
run: |
pip install -e '.[dev]'
- name: Test
run: |
pytest --cov
- uses: codecov/codecov-action@v3
build:
needs:
- build-wheels-and-test
runs-on: ubuntu-latest
needs: test
strategy:
fail-fast: false
matrix:
runs-on:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{matrix.runs-on}}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -57,35 +71,32 @@ jobs:
- name: Install dependencies
run: |
pip install build
- name: Build sdist
- name: Build
run: |
pyproject-build -s
pyproject-build
- uses: pypa/gh-action-pypi-publish@release/v1
if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/')
with:
password: ${{secrets.PYPI_API_TOKEN}}
- uses: actions/upload-artifact@v3
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
if: runner.os == 'Linux' && ! startsWith(github.ref, 'refs/tags/')
with:
path: |
dist/*
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
if: runner.os == 'Linux' && startsWith(github.ref, 'refs/tags/')
with:
# body_path: build/CHANGELOG.md
files: |
dist/*
- uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags/')
with:
password: ${{ secrets.PYPI_API_TOKEN }}
deploy-aur:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: Freed-Wu/update-aur-package@v1.0.11
if: startsWith(github.ref, 'refs/tags/')
with:
package_name: autotools-language-server
ssh_private_key: ${{secrets.AUR_SSH_PRIVATE_KEY}}
Expand All @@ -97,7 +108,7 @@ jobs:
steps:
- name: Trigger Workflow
run: >
curl -X POST -d '{"ref":"main"}'
curl -X POST -d '{"ref": "main"}'
-H "Accept: application/vnd.github.v3+json"
-H "Authorization: Bearer ${{ secrets.GH_TOKEN }}"
-H "Authorization: Bearer ${{secrets.GH_TOKEN}}"
https://api.github.com/repos/Freed-Wu/nur-packages/actions/workflows/version.yml/dispatches
14 changes: 0 additions & 14 deletions CMakeLists.txt

This file was deleted.

36 changes: 16 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[build-system]
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"
requires = ["setuptools_scm[toml] >= 6.2", "setuptools-generate >= 0.0.6"]
build-backend = "setuptools.build_meta"

# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
[project]
name = "autotools-language-server"
description = "autotools language server"
description = "Language server for makefile and configure.ac"
readme = "README.md"
# type_a | type_b
requires-python = ">= 3.10"
Expand All @@ -27,13 +27,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
# dynamic = ["version", "dependencies", "optional-dependencies"]
# https://github.com/pypa/twine/issues/753
dynamic = ["version"]
dependencies = ["colorama", "jinja2", "jsonschema", "platformdirs", "pygls", "tree-sitter"]

[project.optional-dependencies]
dev = ["pytest-cov"]
dynamic = ["version", "dependencies", "optional-dependencies"]

[[project.authors]]
name = "Wu Zhenyu"
Expand All @@ -54,27 +48,29 @@ autotools-language-server = "autotools_language_server.__main__:main"
[tool.scikit-build]
experimental = true

[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.setuptools_scm"

[tool.scikit-build.sdist]
include = ["src/autotools_language_server/_version.py"]

[[tool.scikit-build.generate]]
path = "autotools_language_server/_metainfo.py"
template-path = "templates/metainfo.py"

[tool.setuptools.dynamic.dependencies]
file = "requirements.txt"

# begin: scripts/update-pyproject.toml.pl
[tool.setuptools.dynamic.optional-dependencies.colorize]
file = "requirements/colorize.txt"

[tool.setuptools.dynamic.optional-dependencies.dev]
file = "requirements/dev.txt"

[tool.setuptools.dynamic.optional-dependencies.misc]
file = "requirements/misc.txt"
# end: scripts/update-pyproject.toml.pl

[tool.setuptools_scm]
write_to = "src/autotools_language_server/_version.py"

[tool.setuptools-generate]
write-to = "src/autotools_language_server/_metainfo.py"

[tool.setuptools-generate.metainfo-template]
file = "templates/metainfo.py.j2"

[tool.mdformat]
number = true

Expand Down
7 changes: 2 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env -S pip install -r

colorama
jinja2
jsonschema
platformdirs
pygls
tree-sitter
tree-sitter-languages
tree-sitter-lsp
3 changes: 3 additions & 0 deletions requirements/colorize.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env -S pip install -r

tree-sitter-lsp[colorize]
3 changes: 3 additions & 0 deletions requirements/misc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env -S pip install -r

tree-sitter-lsp[misc] >= 0.0.2
4 changes: 4 additions & 0 deletions src/autotools_language_server/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
r"""Provide ``__version__`` for
`importlib.metadata.version() <https://docs.python.org/3/library/importlib.metadata.html#distribution-versions>`_.
"""
from typing import Literal

try:
from ._version import __version__, __version_tuple__ # type: ignore
except ImportError: # for setuptools-generate
__version__ = "rolling"
__version_tuple__ = (0, 0, 0, __version__, "")

__all__ = ["__version__", "__version_tuple__"]

FILETYPE = Literal["config", "make"]
36 changes: 32 additions & 4 deletions src/autotools_language_server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from contextlib import suppress
from datetime import datetime

from . import FILETYPE
from . import __name__ as NAME
from . import __version__

Expand All @@ -29,6 +30,17 @@ def get_parser():

shtab.add_argument_to(parser)
parser.add_argument("--version", version=VERSION, action="version")
parser.add_argument(
"--generate-schema",
choices=FILETYPE.__args__, # type: ignore
help="generate schema json",
)
parser.add_argument(
"--indent",
type=int,
default=2,
help="generated json's indent",
)
parser.add_argument(
"--check",
nargs="*",
Expand All @@ -49,11 +61,27 @@ def main():
parser = get_parser()
args = parser.parse_args()

from .parser import parse
from .tree_sitter_lsp.diagnose import check
from .utils import DIAGNOSTICS_FINDERS
if args.generate_schema:
from tree_sitter_lsp.utils import pprint

result = check(args.check, DIAGNOSTICS_FINDERS, parse, args.color)
from .misc import get_schema

pprint(get_schema(args.generate_schema), indent=args.indent)
exit()
from tree_sitter_languages import get_parser as _get_parser
from tree_sitter_lsp.diagnose import check

from .finders import DIAGNOSTICS_FINDER_CLASSES
from .utils import get_filetype

parser = _get_parser("make")
result = check(
args.check,
parser.parse,
DIAGNOSTICS_FINDER_CLASSES,
get_filetype,
args.color,
)
if args.check:
exit(result)

Expand Down
1 change: 0 additions & 1 deletion src/autotools_language_server/assets/json/autotools.json

This file was deleted.

1,652 changes: 1,652 additions & 0 deletions src/autotools_language_server/assets/json/config.json

Large diffs are not rendered by default.

Loading

0 comments on commit 4355eb7

Please sign in to comment.