Remove legacy distutils support.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
095d5d8f4e
commit
05d591a906
|
@ -11,7 +11,7 @@ recommend installing version 0.6.4.
|
|||
|
||||
#### Installing
|
||||
|
||||
This package uses distutils, so you can just run:
|
||||
This package uses setuptools, so you can just run:
|
||||
|
||||
python setup.py install
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
import itertools
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Dict, Generator, List, Tuple
|
||||
from typing import Any, Generator, List, Tuple
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
with open("README.md") as fh:
|
||||
long_description = fh.read()
|
||||
|
@ -26,8 +27,7 @@ def recur_expand(target_root: Any, dir: Any) -> Generator[Tuple[str, List[str]],
|
|||
yield os.path.join(target_root, root), paths
|
||||
|
||||
|
||||
# We should be installable with either setuptools or distutils.
|
||||
package_info = dict(
|
||||
setup(
|
||||
name="zulip",
|
||||
version=version(),
|
||||
description="Bindings for the Zulip message API",
|
||||
|
@ -63,9 +63,6 @@ package_info = dict(
|
|||
"zulip-api=zulip.cli:cli",
|
||||
],
|
||||
},
|
||||
) # type: Dict[str, Any]
|
||||
|
||||
setuptools_info = dict(
|
||||
install_requires=[
|
||||
"requests[security]>=0.12.1",
|
||||
"matrix_client",
|
||||
|
@ -73,28 +70,5 @@ setuptools_info = dict(
|
|||
"click",
|
||||
"typing_extensions>=3.7",
|
||||
],
|
||||
packages=find_packages(exclude=["tests"]),
|
||||
)
|
||||
|
||||
try:
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
package_info.update(setuptools_info)
|
||||
package_info["packages"] = find_packages(exclude=["tests"])
|
||||
|
||||
except ImportError:
|
||||
from distutils.core import setup
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
# Manual dependency check
|
||||
try:
|
||||
import requests
|
||||
|
||||
assert LooseVersion(requests.__version__) >= LooseVersion("0.12.1")
|
||||
except (ImportError, AssertionError):
|
||||
print("requests >=0.12.1 is not installed", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
package_info["packages"] = ["zulip"]
|
||||
|
||||
|
||||
setup(**package_info)
|
||||
|
|
|
@ -11,7 +11,6 @@ import traceback
|
|||
import types
|
||||
import urllib.parse
|
||||
from configparser import SafeConfigParser
|
||||
from distutils.version import LooseVersion
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
|
@ -37,9 +36,6 @@ assert sys.version_info >= (3, 6)
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Check that we have a recent enough version
|
||||
# Older versions don't provide the 'json' attribute on responses.
|
||||
assert LooseVersion(requests.__version__) >= LooseVersion("0.12.1")
|
||||
# In newer versions, the 'json' attribute is a function, not a property
|
||||
requests_json_is_function = callable(requests.Response.json)
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Dict, Optional
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
ZULIP_BOTS_VERSION = "0.8.1"
|
||||
IS_PYPA_PACKAGE = False
|
||||
|
@ -21,8 +19,7 @@ if not IS_PYPA_PACKAGE:
|
|||
with open("README.md") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
# We should be installable with either setuptools or distutils.
|
||||
package_info = dict(
|
||||
setup(
|
||||
name="zulip_bots",
|
||||
version=ZULIP_BOTS_VERSION,
|
||||
description="Zulip's Bot framework",
|
||||
|
@ -54,9 +51,6 @@ package_info = dict(
|
|||
"zulip-bot-shell=zulip_bots.bot_shell:main",
|
||||
],
|
||||
},
|
||||
) # type: Dict[str, Any]
|
||||
|
||||
setuptools_info = dict(
|
||||
install_requires=[
|
||||
"pip",
|
||||
"zulip",
|
||||
|
@ -66,47 +60,6 @@ setuptools_info = dict(
|
|||
"typing_extensions",
|
||||
'importlib-metadata >= 3.6; python_version < "3.10"',
|
||||
],
|
||||
packages=find_packages(),
|
||||
package_data=package_data,
|
||||
)
|
||||
|
||||
try:
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
package_info.update(setuptools_info)
|
||||
package_info["packages"] = find_packages()
|
||||
package_info["package_data"] = package_data
|
||||
|
||||
except ImportError:
|
||||
from distutils.core import setup
|
||||
from distutils.version import LooseVersion
|
||||
from importlib import import_module
|
||||
|
||||
# Manual dependency check
|
||||
def check_dependency_manually(module_name: str, version: Optional[str] = None) -> None:
|
||||
try:
|
||||
module = import_module(module_name) # type: Any
|
||||
if version is not None:
|
||||
assert LooseVersion(module.__version__) >= LooseVersion(version)
|
||||
except (ImportError, AssertionError):
|
||||
if version is not None:
|
||||
print(
|
||||
f"{module_name}>={version} is not installed.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
else:
|
||||
print(f"{module_name} is not installed.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
check_dependency_manually("zulip")
|
||||
check_dependency_manually("mock", "2.0.0")
|
||||
check_dependency_manually("html2text")
|
||||
check_dependency_manually("PyDictionary")
|
||||
|
||||
# Include all submodules under bots/
|
||||
package_list = ["zulip_bots"]
|
||||
dirs = os.listdir("zulip_bots/bots/")
|
||||
for dir_name in dirs:
|
||||
if os.path.isdir(os.path.join("zulip_bots/bots/", dir_name)):
|
||||
package_list.append("zulip_bots.bots." + dir_name)
|
||||
package_info["packages"] = package_list
|
||||
|
||||
setup(**package_info)
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
from typing import Any, Dict, Optional
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
ZULIP_BOTSERVER_VERSION = "0.8.1"
|
||||
|
||||
with open("README.md") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
# We should be installable with either setuptools or distutils.
|
||||
package_info = dict(
|
||||
setup(
|
||||
name="zulip_botserver",
|
||||
version=ZULIP_BOTSERVER_VERSION,
|
||||
description="Zulip's Flask server for running bots",
|
||||
|
@ -42,48 +40,10 @@ package_info = dict(
|
|||
},
|
||||
test_suite="tests",
|
||||
package_data={"zulip_botserver": ["py.typed"]},
|
||||
) # type: Dict[str, Any]
|
||||
|
||||
setuptools_info = dict(
|
||||
install_requires=[
|
||||
"zulip",
|
||||
"zulip_bots",
|
||||
"flask>=0.12.2",
|
||||
],
|
||||
packages=find_packages(exclude=["tests"]),
|
||||
)
|
||||
|
||||
try:
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
package_info.update(setuptools_info)
|
||||
package_info["packages"] = find_packages(exclude=["tests"])
|
||||
|
||||
except ImportError:
|
||||
from distutils.core import setup
|
||||
from distutils.version import LooseVersion
|
||||
from importlib import import_module
|
||||
|
||||
# Manual dependency check
|
||||
def check_dependency_manually(module_name: str, version: Optional[str] = None) -> None:
|
||||
try:
|
||||
module = import_module(module_name) # type: Any
|
||||
if version is not None:
|
||||
assert LooseVersion(module.__version__) >= LooseVersion(version)
|
||||
except (ImportError, AssertionError):
|
||||
if version is not None:
|
||||
print(
|
||||
f"{module_name}>={version} is not installed.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
else:
|
||||
print(f"{module_name} is not installed.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
check_dependency_manually("zulip")
|
||||
check_dependency_manually("zulip_bots")
|
||||
check_dependency_manually("flask", "0.12.2")
|
||||
|
||||
package_info["packages"] = ["zulip_botserver"]
|
||||
|
||||
|
||||
setup(**package_info)
|
||||
|
|
Loading…
Reference in a new issue