Follow PEP 518

This commit is contained in:
Lonami Exo 2020-10-05 10:47:28 +02:00
parent 3e188d0344
commit 180105a965
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,12 @@
# https://snarky.ca/what-the-heck-is-pyproject-toml/
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
# Need to use legacy format for the time being
# https://tox.readthedocs.io/en/3.20.0/example/basic.html#pyproject-toml-tox-legacy-ini
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py35,py36,py37,py38
@ -22,3 +31,5 @@ commands =
flake8 telethon/ telethon_generator/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 telethon/ telethon_generator/ tests/ --count --exit-zero --exclude telethon/tl/,telethon/errors/rpcerrorlist.py --max-complexity=10 --max-line-length=127 --statistics
"""

View File

@ -15,12 +15,14 @@ import json
import os
import re
import shutil
import sys
from pathlib import Path
from subprocess import run
from sys import argv
from setuptools import find_packages, setup
# Needed since we're importing local files
sys.path.insert(0, os.path.dirname(__file__))
class TempWorkDir:
"""Switches the working directory to be the one on which this file lives,
@ -148,7 +150,7 @@ def generate(which, action='gen'):
)
def main():
def main(argv):
if len(argv) >= 2 and argv[1] in ('gen', 'clean'):
generate(argv[2:], argv[1])
@ -231,4 +233,4 @@ def main():
if __name__ == '__main__':
with TempWorkDir():
main()
main(sys.argv)