fix: #1631: move pyproject.toml to avoid PEP 517 conflict
This commit is contained in:
parent
83864f890a
commit
95a0b2db2c
42
scripts/changelog.py
Executable file
42
scripts/changelog.py
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from os import path
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
import towncrier
|
||||||
|
import click
|
||||||
|
except ImportError:
|
||||||
|
print("Please make sure you have a installed towncrier and click before using this tool")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
@click.command()
|
||||||
|
@click.option(
|
||||||
|
"--draft",
|
||||||
|
"draft",
|
||||||
|
default=False,
|
||||||
|
flag_value=True,
|
||||||
|
help="Render the news fragments, don't write to files, " "don't check versions.",
|
||||||
|
)
|
||||||
|
@click.option("--dir", "directory", default=path.dirname(path.abspath(__file__)))
|
||||||
|
@click.option("--name", "project_name", default=None)
|
||||||
|
@click.option(
|
||||||
|
"--version",
|
||||||
|
"project_version",
|
||||||
|
default=None,
|
||||||
|
help="Render the news fragments using given version.",
|
||||||
|
)
|
||||||
|
@click.option("--date", "project_date", default=None)
|
||||||
|
@click.option(
|
||||||
|
"--yes",
|
||||||
|
"answer_yes",
|
||||||
|
default=False,
|
||||||
|
flag_value=True,
|
||||||
|
help="Do not ask for confirmation to remove news fragments.",
|
||||||
|
)
|
||||||
|
def _main(draft, directory, project_name, project_version, project_date, answer_yes):
|
||||||
|
return towncrier.__main(
|
||||||
|
draft, directory, project_name, project_version, project_date, answer_yes
|
||||||
|
)
|
||||||
|
|
||||||
|
_main()
|
|
@ -1,7 +1,7 @@
|
||||||
[tool.towncrier]
|
[tool.towncrier]
|
||||||
package = "sanic"
|
package = "sanic"
|
||||||
package_dir = "."
|
package_dir = "."
|
||||||
filename = "CHANGELOG.rst"
|
filename = "../CHANGELOG.rst"
|
||||||
directory = "./changelogs"
|
directory = "./changelogs"
|
||||||
underlines = ["=", "*", "~"]
|
underlines = ["=", "*", "~"]
|
||||||
issue_format = "`#{issue} <https://github.com/huge-success/sanic/issues/{issue}>`__"
|
issue_format = "`#{issue} <https://github.com/huge-success/sanic/issues/{issue}>`__"
|
|
@ -5,7 +5,7 @@ from collections import OrderedDict
|
||||||
from configparser import RawConfigParser
|
from configparser import RawConfigParser
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from json import dumps
|
from json import dumps
|
||||||
from os import path
|
from os import path, chdir
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
from jinja2 import Environment, BaseLoader
|
from jinja2 import Environment, BaseLoader
|
||||||
|
@ -56,6 +56,18 @@ RELEASE_NOTE_UPDATE_URL = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Directory:
|
||||||
|
def __init__(self):
|
||||||
|
self._old_path = path.dirname(path.abspath(__file__))
|
||||||
|
self._new_path = path.dirname(self._old_path)
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
chdir(self._new_path)
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
chdir(self._old_path)
|
||||||
|
|
||||||
|
|
||||||
def _run_shell_command(command: list):
|
def _run_shell_command(command: list):
|
||||||
try:
|
try:
|
||||||
process = Popen(
|
process = Popen(
|
||||||
|
@ -302,4 +314,5 @@ if __name__ == "__main__":
|
||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
args = cli.parse_args()
|
args = cli.parse_args()
|
||||||
release(args)
|
with Directory() as _:
|
||||||
|
release(args)
|
Loading…
Reference in New Issue
Block a user