diff --git a/tox.ini b/pyproject.toml similarity index 72% rename from tox.ini rename to pyproject.toml index 8c9d6390..c2ab75e6 100644 --- a/tox.ini +++ b/pyproject.toml @@ -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 + +""" diff --git a/setup.py b/setup.py index b03fe95c..3446369d 100755 --- a/setup.py +++ b/setup.py @@ -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)