mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-10 02:17:59 +00:00
Compare commits
1 commit
8fb966f02c
...
cab8ca81c6
Author | SHA1 | Date | |
---|---|---|---|
cab8ca81c6 |
37
relay/dev.py
37
relay/dev.py
|
@ -1,6 +1,5 @@
|
|||
import click
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
@ -47,23 +46,21 @@ def cli_install():
|
|||
|
||||
|
||||
@cli.command('lint')
|
||||
@click.argument('path', required = False, type = Path, default = REPO.joinpath('relay'))
|
||||
@click.argument('path', required = False, default = 'relay')
|
||||
@click.option('--strict', '-s', is_flag = True, help = 'Enable strict mode for mypy')
|
||||
@click.option('--watch', '-w', is_flag = True,
|
||||
help = 'Automatically, re-run the linters on source change')
|
||||
def cli_lint(path: Path, strict: bool, watch: bool) -> None:
|
||||
path = path.expanduser().resolve()
|
||||
|
||||
if watch:
|
||||
handle_run_watcher([sys.executable, "-m", "relay.dev", "lint", str(path)], wait = True)
|
||||
return
|
||||
|
||||
flake8 = [sys.executable, '-m', 'flake8', str(path)]
|
||||
mypy = [sys.executable, '-m', 'mypy', str(path)]
|
||||
def cli_lint(path: str, strict: bool, watch: bool) -> None:
|
||||
flake8 = [sys.executable, '-m', 'flake8', path]
|
||||
mypy = [sys.executable, '-m', 'mypy', path]
|
||||
|
||||
if strict:
|
||||
mypy.append('--strict')
|
||||
|
||||
if watch:
|
||||
handle_run_watcher(mypy, flake8, wait = True)
|
||||
return
|
||||
|
||||
click.echo('----- flake8 -----')
|
||||
subprocess.run(flake8)
|
||||
|
||||
|
@ -71,24 +68,6 @@ def cli_lint(path: Path, strict: bool, watch: bool) -> None:
|
|||
subprocess.run(mypy)
|
||||
|
||||
|
||||
@cli.command('clean')
|
||||
def cli_clean():
|
||||
dirs = {
|
||||
'dist',
|
||||
'build',
|
||||
'dist-pypi'
|
||||
}
|
||||
|
||||
for directory in dirs:
|
||||
shutil.rmtree(directory, ignore_errors = True)
|
||||
|
||||
for path in REPO.glob('*.egg-info'):
|
||||
shutil.rmtree(path)
|
||||
|
||||
for path in REPO.glob('*.spec'):
|
||||
path.unlink()
|
||||
|
||||
|
||||
@cli.command('build')
|
||||
def cli_build():
|
||||
with TemporaryDirectory() as tmp:
|
||||
|
|
|
@ -4,8 +4,8 @@ aiohttp-swagger[performance] == 1.0.16
|
|||
argon2-cffi == 23.1.0
|
||||
barkshark-sql @ https://git.barkshark.xyz/barkshark/bsql/archive/0.1.2.tar.gz
|
||||
click >= 8.1.2
|
||||
hamlish-jinja @ https://git.barkshark.xyz/barkshark/hamlish-jinja/archive/0.3.5.tar.gz
|
||||
hiredis == 2.3.2
|
||||
jinja2-haml == 0.3.5
|
||||
markdown == 3.5.2
|
||||
platformdirs == 4.2.0
|
||||
pyyaml >= 6.0
|
||||
|
|
|
@ -9,7 +9,7 @@ license = AGPLv3
|
|||
license_file = LICENSE
|
||||
classifiers =
|
||||
Environment :: Console
|
||||
License :: OSI Approved :: GNU Affero General Public License v3
|
||||
License :: OSI Approved :: AGPLv3 License
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
|
|
Loading…
Reference in a new issue