mirror of https://github.com/astral-sh/ruff
Try other
This commit is contained in:
parent
e4f6780716
commit
423d1a9966
|
|
@ -1,122 +0,0 @@
|
||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
cargo_build:
|
|
||||||
name: "cargo build"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-cargo
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
- run: cargo build --release
|
|
||||||
|
|
||||||
cargo_fmt:
|
|
||||||
name: "cargo fmt"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-cargo
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
- run: cargo fmt --check
|
|
||||||
|
|
||||||
cargo_clippy:
|
|
||||||
name: "cargo clippy"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-cargo
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
- run: cargo clippy -- -D warnings
|
|
||||||
|
|
||||||
cargo_test:
|
|
||||||
name: "cargo test"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-cargo
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
- run: cargo test
|
|
||||||
|
|
||||||
maturin_build:
|
|
||||||
name: "maturin build"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
- uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.10'
|
|
||||||
- run: pip install maturin
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-cargo
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
- run: maturin build -b bin
|
|
||||||
|
|
@ -1,17 +1,26 @@
|
||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
PACKAGE_NAME: ruff
|
||||||
|
PYTHON_VERSION: "3.10"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
macos:
|
macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
|
|
@ -23,19 +32,19 @@ jobs:
|
||||||
uses: messense/maturin-action@v1
|
uses: messense/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
target: x86_64
|
target: x86_64
|
||||||
args: --release --out dist --sdist
|
args: -i ${{ env.PYTHON_VERSION }} --release --out dist --sdist
|
||||||
|
maturin-version: "latest"
|
||||||
- name: Install built wheel - x86_64
|
- name: Install built wheel - x86_64
|
||||||
run: |
|
run: |
|
||||||
pip install ruff --no-index --find-links dist --force-reinstall
|
pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
|
||||||
python -c "import ruff"
|
|
||||||
- name: Build wheels - universal2
|
- name: Build wheels - universal2
|
||||||
uses: messense/maturin-action@v1
|
uses: messense/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
args: --release --universal2 --out dist
|
args: --release --universal2 --out dist
|
||||||
|
maturin-version: "latest"
|
||||||
- name: Install built wheel - universal2
|
- name: Install built wheel - universal2
|
||||||
run: |
|
run: |
|
||||||
pip install ruff --no-index --find-links dist --force-reinstall
|
pip install dist/${{ env.PACKAGE_NAME }}-*universal2.whl --force-reinstall
|
||||||
python -c "import ruff"
|
|
||||||
- name: Upload wheels
|
- name: Upload wheels
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
|
@ -48,10 +57,10 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
target: [x64, x86]
|
target: [x64, x86]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
architecture: ${{ matrix.target }}
|
architecture: ${{ matrix.target }}
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
|
|
@ -63,11 +72,12 @@ jobs:
|
||||||
uses: messense/maturin-action@v1
|
uses: messense/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
args: --release --out dist
|
args: -i ${{ env.PYTHON_VERSION }} --release --out dist
|
||||||
|
maturin-version: "latest"
|
||||||
- name: Install built wheel
|
- name: Install built wheel
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
pip install ruff --no-index --find-links dist --force-reinstall
|
python -m pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
|
||||||
python -c "import ruff"
|
|
||||||
- name: Upload wheels
|
- name: Upload wheels
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
|
@ -80,154 +90,158 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
target: [x86_64, i686]
|
target: [x86_64, i686]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: messense/maturin-action@v1
|
uses: messense/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
manylinux: auto
|
manylinux: auto
|
||||||
args: --release --out dist
|
args: -i ${{ env.PYTHON_VERSION }} --release --out dist
|
||||||
|
maturin-version: "latest"
|
||||||
- name: Install built wheel
|
- name: Install built wheel
|
||||||
if: matrix.target == 'x86_64'
|
if: matrix.target == 'x86_64'
|
||||||
run: |
|
run: |
|
||||||
pip install ruff --no-index --find-links dist --force-reinstall
|
pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
|
||||||
python -c "import ruff"
|
|
||||||
- name: Upload wheels
|
- name: Upload wheels
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: wheels
|
name: wheels
|
||||||
path: dist
|
path: dist
|
||||||
|
|
||||||
linux-cross:
|
# linux-cross:
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
target: [aarch64, armv7, s390x, ppc64le, ppc64]
|
# target: [aarch64, armv7]
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v2
|
# - uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
# - uses: actions/setup-python@v4
|
||||||
with:
|
# with:
|
||||||
python-version: '3.10'
|
# python-version: ${{ env.PYTHON_VERSION }}
|
||||||
- name: Build wheels
|
# - name: Build wheels
|
||||||
uses: messense/maturin-action@v1
|
# uses: messense/maturin-action@v1
|
||||||
with:
|
# with:
|
||||||
target: ${{ matrix.target }}
|
# target: ${{ matrix.target }}
|
||||||
manylinux: auto
|
# manylinux: auto
|
||||||
args: --release --out dist
|
# args: -i ${{ env.PYTHON_VERSION }} --release --out dist
|
||||||
- uses: uraimo/run-on-arch-action@v2.0.5
|
# maturin-version: "latest"
|
||||||
if: matrix.target != 'ppc64'
|
# - uses: uraimo/run-on-arch-action@v2.0.5
|
||||||
name: Install built wheel
|
# if: matrix.target != 'ppc64'
|
||||||
with:
|
# name: Install built wheel
|
||||||
arch: ${{ matrix.target }}
|
# with:
|
||||||
distro: ubuntu20.04
|
# arch: ${{ matrix.target }}
|
||||||
githubToken: ${{ github.token }}
|
# distro: ubuntu20.04
|
||||||
install: |
|
# githubToken: ${{ github.token }}
|
||||||
apt-get update
|
# install: |
|
||||||
apt-get install -y --no-install-recommends python3 python3-pip
|
# apt-get update
|
||||||
pip3 install -U pip
|
# apt-get install -y --no-install-recommends python3 python3-pip
|
||||||
run: |
|
# pip3 install -U pip
|
||||||
pip3 install ruff --no-index --find-links dist/ --force-reinstall
|
# run: |
|
||||||
python3 -c "import ruff"
|
# pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
|
||||||
- name: Upload wheels
|
# - name: Upload wheels
|
||||||
uses: actions/upload-artifact@v2
|
# uses: actions/upload-artifact@v2
|
||||||
with:
|
# with:
|
||||||
name: wheels
|
# name: wheels
|
||||||
path: dist
|
# path: dist
|
||||||
|
|
||||||
musllinux:
|
# musllinux:
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
target:
|
# target:
|
||||||
- x86_64-unknown-linux-musl
|
# - x86_64-unknown-linux-musl
|
||||||
- i686-unknown-linux-musl
|
# - i686-unknown-linux-musl
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v2
|
# - uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
# - uses: actions/setup-python@v4
|
||||||
with:
|
# with:
|
||||||
python-version: '3.10'
|
# python-version: ${{ env.PYTHON_VERSION }}
|
||||||
architecture: x64
|
# architecture: x64
|
||||||
- name: Build wheels
|
# - name: Build wheels
|
||||||
uses: messense/maturin-action@v1
|
# uses: messense/maturin-action@v1
|
||||||
with:
|
# with:
|
||||||
target: ${{ matrix.target }}
|
# target: ${{ matrix.target }}
|
||||||
manylinux: musllinux_1_2
|
# manylinux: musllinux_1_2
|
||||||
args: --release --out dist
|
# args: -i ${{ env.PYTHON_VERSION }} --release --out dist
|
||||||
- name: Install built wheel
|
# maturin-version: "latest"
|
||||||
if: matrix.target == 'x86_64-unknown-linux-musl'
|
# - name: Install built wheel
|
||||||
uses: addnab/docker-run-action@v3
|
# if: matrix.target == 'x86_64-unknown-linux-musl'
|
||||||
with:
|
# uses: addnab/docker-run-action@v3
|
||||||
image: alpine:latest
|
# with:
|
||||||
options: -v ${{ github.workspace }}:/io -w /io
|
# image: alpine:latest
|
||||||
run: |
|
# options: -v ${{ github.workspace }}:/io -w /io
|
||||||
apk add py3-pip
|
# run: |
|
||||||
pip3 install -U pip
|
# apk add py3-pip
|
||||||
pip3 install ruff --no-index --find-links /io/dist/ --force-reinstall
|
# pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links /io/dist/ --force-reinstall
|
||||||
python3 -c "import ruff"
|
# - name: Upload wheels
|
||||||
- name: Upload wheels
|
# uses: actions/upload-artifact@v2
|
||||||
uses: actions/upload-artifact@v2
|
# with:
|
||||||
with:
|
# name: wheels
|
||||||
name: wheels
|
# path: dist
|
||||||
path: dist
|
#
|
||||||
|
# musllinux-cross:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# matrix:
|
||||||
|
# platform:
|
||||||
|
# - target: aarch64-unknown-linux-musl
|
||||||
|
# arch: aarch64
|
||||||
|
# - target: armv7-unknown-linux-musleabihf
|
||||||
|
# arch: armv7
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v3
|
||||||
|
# - uses: actions/setup-python@v4
|
||||||
|
# with:
|
||||||
|
# python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
# - name: Build wheels
|
||||||
|
# uses: messense/maturin-action@v1
|
||||||
|
# with:
|
||||||
|
# target: ${{ matrix.platform.target }}
|
||||||
|
# manylinux: musllinux_1_2
|
||||||
|
# args: -i ${{ env.PYTHON_VERSION }} --release --out dist
|
||||||
|
# maturin-version: "latest"
|
||||||
|
# - uses: uraimo/run-on-arch-action@master
|
||||||
|
# name: Install built wheel
|
||||||
|
# with:
|
||||||
|
# arch: ${{ matrix.platform.arch }}
|
||||||
|
# distro: alpine_latest
|
||||||
|
# githubToken: ${{ github.token }}
|
||||||
|
# install: |
|
||||||
|
# apk add py3-pip
|
||||||
|
# run: |
|
||||||
|
# pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
|
||||||
|
# - name: Upload wheels
|
||||||
|
# uses: actions/upload-artifact@v2
|
||||||
|
# with:
|
||||||
|
# name: wheels
|
||||||
|
# path: dist
|
||||||
|
|
||||||
musllinux-cross:
|
# release:
|
||||||
runs-on: ubuntu-latest
|
# name: Release
|
||||||
strategy:
|
# runs-on: ubuntu-latest
|
||||||
matrix:
|
# needs:
|
||||||
platform:
|
# - lint
|
||||||
- target: aarch64-unknown-linux-musl
|
# - macos
|
||||||
arch: aarch64
|
# - windows
|
||||||
- target: armv7-unknown-linux-musleabihf
|
# - linux
|
||||||
arch: armv7
|
# - linux-cross
|
||||||
steps:
|
# - musllinux
|
||||||
- uses: actions/checkout@v2
|
# - musllinux-cross
|
||||||
- uses: actions/setup-python@v4
|
# - pypy
|
||||||
with:
|
# if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
python-version: '3.10'
|
# steps:
|
||||||
- name: Build wheels
|
# - uses: actions/download-artifact@v2
|
||||||
uses: messense/maturin-action@v1
|
# with:
|
||||||
with:
|
# name: wheels
|
||||||
target: ${{ matrix.platform.target }}
|
# - uses: actions/setup-python@v2
|
||||||
manylinux: musllinux_1_2
|
# - name: Publish to PyPi
|
||||||
args: --release --out dist
|
# env:
|
||||||
- uses: uraimo/run-on-arch-action@master
|
# TWINE_USERNAME: __token__
|
||||||
name: Install built wheel
|
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
||||||
with:
|
# run: |
|
||||||
arch: ${{ matrix.platform.arch }}
|
# pip install --upgrade twine
|
||||||
distro: alpine_latest
|
# twine upload --skip-existing *
|
||||||
githubToken: ${{ github.token }}
|
|
||||||
install: |
|
|
||||||
apk add py3-pip
|
|
||||||
pip3 install -U pip
|
|
||||||
run: |
|
|
||||||
pip3 install ruff --no-index --find-links dist/ --force-reinstall
|
|
||||||
python3 -c "import ruff"
|
|
||||||
- name: Upload wheels
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: wheels
|
|
||||||
path: dist
|
|
||||||
|
|
||||||
release:
|
|
||||||
name: Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: "startsWith(github.ref, 'refs/tags/')"
|
|
||||||
needs: [ macos, windows, linux, linux-cross, musllinux, musllinux-cross ]
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: wheels
|
|
||||||
- uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.10'
|
|
||||||
- name: Publish to PyPi
|
|
||||||
env:
|
|
||||||
TWINE_USERNAME: __token__
|
|
||||||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
pip install --upgrade twine
|
|
||||||
twine upload --skip-existing *
|
|
||||||
|
|
|
||||||
|
|
@ -1712,6 +1712,7 @@ dependencies = [
|
||||||
"common-path",
|
"common-path",
|
||||||
"dirs 4.0.0",
|
"dirs 4.0.0",
|
||||||
"fern",
|
"fern",
|
||||||
|
"filetime",
|
||||||
"log",
|
"log",
|
||||||
"notify",
|
"notify",
|
||||||
"pyo3",
|
"pyo3",
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "ruff"
|
name = "ruff"
|
||||||
crate-type = ["cdylib", "lib"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = { version = "1.0.60" }
|
anyhow = { version = "1.0.60" }
|
||||||
|
|
@ -18,6 +17,7 @@ colored = { version = "2.0.0" }
|
||||||
common-path = { version = "1.0.0" }
|
common-path = { version = "1.0.0" }
|
||||||
dirs = { version = "4.0.0" }
|
dirs = { version = "4.0.0" }
|
||||||
fern = { version = "0.6.1" }
|
fern = { version = "0.6.1" }
|
||||||
|
filetime = "0.2.17"
|
||||||
log = { version = "0.4.17" }
|
log = { version = "0.4.17" }
|
||||||
notify = { version = "4.0.17" }
|
notify = { version = "4.0.17" }
|
||||||
pyo3 = { version = "0.16.5", features = ["extension-module", "abi3-py37"] }
|
pyo3 = { version = "0.16.5", features = ["extension-module", "abi3-py37"] }
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ author = "Charlie Marsh"
|
||||||
author_email = "charlie.r.marsh@gmail.com"
|
author_email = "charlie.r.marsh@gmail.com"
|
||||||
url = "https://github.com/charliermarsh/ruff"
|
url = "https://github.com/charliermarsh/ruff"
|
||||||
description = "An extremely fast Python linter, written in Rust."
|
description = "An extremely fast Python linter, written in Rust."
|
||||||
|
requires-python = ">=3.7"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["maturin>=0.13,<0.14"]
|
requires = ["maturin>=0.13,<0.14"]
|
||||||
|
|
@ -28,3 +29,5 @@ build-backend = "maturin"
|
||||||
|
|
||||||
[tool.maturin]
|
[tool.maturin]
|
||||||
bindings = "bin"
|
bindings = "bin"
|
||||||
|
sdist-include = ["Cargo.lock"]
|
||||||
|
strip = true
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use std::collections::hash_map::DefaultHasher;
|
use std::collections::hash_map::DefaultHasher;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
use std::os::unix::fs::MetadataExt;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use cacache::Error::EntryNotFound;
|
use cacache::Error::EntryNotFound;
|
||||||
|
use filetime::FileTime;
|
||||||
use log::error;
|
use log::error;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
@ -14,7 +14,6 @@ const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct CacheMetadata {
|
struct CacheMetadata {
|
||||||
size: u64,
|
|
||||||
mtime: i64,
|
mtime: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,7 +89,7 @@ pub fn get(path: &Path, settings: &Settings, mode: &Mode) -> Option<Vec<Message>
|
||||||
Ok(encoded) => match path.metadata() {
|
Ok(encoded) => match path.metadata() {
|
||||||
Ok(m) => match bincode::deserialize::<CheckResult>(&encoded[..]) {
|
Ok(m) => match bincode::deserialize::<CheckResult>(&encoded[..]) {
|
||||||
Ok(CheckResult { metadata, messages }) => {
|
Ok(CheckResult { metadata, messages }) => {
|
||||||
if m.size() == metadata.size && m.mtime() == metadata.mtime {
|
if FileTime::from_last_modification_time(&m).unix_seconds() == metadata.mtime {
|
||||||
return Some(messages);
|
return Some(messages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -112,8 +111,7 @@ pub fn set(path: &Path, settings: &Settings, messages: &[Message], mode: &Mode)
|
||||||
if let Ok(metadata) = path.metadata() {
|
if let Ok(metadata) = path.metadata() {
|
||||||
let check_result = CheckResultRef {
|
let check_result = CheckResultRef {
|
||||||
metadata: &CacheMetadata {
|
metadata: &CacheMetadata {
|
||||||
size: metadata.size(),
|
mtime: FileTime::from_last_modification_time(&metadata).unix_seconds(),
|
||||||
mtime: metadata.mtime(),
|
|
||||||
},
|
},
|
||||||
messages,
|
messages,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue