chore: add `clean` option

This commit is contained in:
Shunsuke Shibayama 2023-09-10 12:44:47 +09:00
parent 6b807d17e1
commit 75be1077db
2 changed files with 23 additions and 14 deletions

View File

@ -10,6 +10,12 @@
## Installation
### pip
```bash
pip install pylyzer
```
### cargo (rust package manager)
```bash
@ -25,18 +31,6 @@ cargo install --path .
Make sure that `cargo/rustc` is up-to-date, as pylyzer may be written with the latest language features.
### pip
```bash
pip install pylyzer
```
__If installed this way, you also need to [install Erg](https://github.com/mtshiba/ergup).__
```bash
curl -L https://github.com/mtshiba/ergup/raw/main/ergup.py | python3
```
### [GitHub Releases](https://github.com/mtshiba/pylyzer/releases/latest)
## What is the advantage over pylint, pyright, pytype, etc.?

View File

@ -3,10 +3,22 @@ import os
import shlex
from glob import glob
import tomllib
import shutil
from setuptools import setup
from setuptools import setup, Command
from setuptools_rust import RustBin
class Clean(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
# super().run()
for d in ["build", "dist", "src/pylyzer.egg-info"]:
shutil.rmtree(d, ignore_errors=True)
with open("README.md", encoding="utf-8", errors="ignore") as fp:
long_description = fp.read()
@ -23,7 +35,7 @@ cargo_args = ["--no-default-features"]
home = os.path.expanduser("~")
file_and_dirs = glob(".erg/lib/**", recursive=True, root_dir=home)
paths = [Path(home + "/" + path) for path in file_and_dirs if os.path.isfile(home + "/" + path)]
files = [(str(path).removesuffix("/" + path.name).removeprefix(home + "/"), str(path)) for path in paths]
files = [(str(path).removesuffix("/" + path.name).removeprefix(home), str(path)) for path in paths]
data_files = {}
for key, value in files:
if key in data_files:
@ -46,6 +58,9 @@ setup(
rust_extensions=[
RustBin("pylyzer", args=cargo_args, cargo_manifest_args=["--locked"])
],
cmdclass={
"clean": Clean,
},
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Operating System :: OS Independent",