mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-23 15:08:00 +00:00
Compare commits
5 commits
cab8ca81c6
...
8fb966f02c
Author | SHA1 | Date | |
---|---|---|---|
8fb966f02c | |||
22bba6e85e | |||
12b9ee317a | |||
9708d526a9 | |||
673175b80b |
37
relay/dev.py
37
relay/dev.py
|
@ -1,5 +1,6 @@
|
|||
import click
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
@ -46,21 +47,23 @@ def cli_install():
|
|||
|
||||
|
||||
@cli.command('lint')
|
||||
@click.argument('path', required = False, default = 'relay')
|
||||
@click.argument('path', required = False, type = Path, default = REPO.joinpath('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: str, strict: bool, watch: bool) -> None:
|
||||
flake8 = [sys.executable, '-m', 'flake8', path]
|
||||
mypy = [sys.executable, '-m', 'mypy', path]
|
||||
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)]
|
||||
|
||||
if strict:
|
||||
mypy.append('--strict')
|
||||
|
||||
if watch:
|
||||
handle_run_watcher(mypy, flake8, wait = True)
|
||||
return
|
||||
|
||||
click.echo('----- flake8 -----')
|
||||
subprocess.run(flake8)
|
||||
|
||||
|
@ -68,6 +71,24 @@ def cli_lint(path: str, 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 :: AGPLv3 License
|
||||
License :: OSI Approved :: GNU Affero General Public License v3
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
|
|
Loading…
Reference in a new issue