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
|
#### Installing
|
||||||
|
|
||||||
This package uses distutils, so you can just run:
|
This package uses setuptools, so you can just run:
|
||||||
|
|
||||||
python setup.py install
|
python setup.py install
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
import sys
|
from typing import Any, Generator, List, Tuple
|
||||||
from typing import Any, Dict, Generator, List, Tuple
|
|
||||||
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
with open("README.md") as fh:
|
with open("README.md") as fh:
|
||||||
long_description = fh.read()
|
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
|
yield os.path.join(target_root, root), paths
|
||||||
|
|
||||||
|
|
||||||
# We should be installable with either setuptools or distutils.
|
setup(
|
||||||
package_info = dict(
|
|
||||||
name="zulip",
|
name="zulip",
|
||||||
version=version(),
|
version=version(),
|
||||||
description="Bindings for the Zulip message API",
|
description="Bindings for the Zulip message API",
|
||||||
|
@ -63,9 +63,6 @@ package_info = dict(
|
||||||
"zulip-api=zulip.cli:cli",
|
"zulip-api=zulip.cli:cli",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
) # type: Dict[str, Any]
|
|
||||||
|
|
||||||
setuptools_info = dict(
|
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"requests[security]>=0.12.1",
|
"requests[security]>=0.12.1",
|
||||||
"matrix_client",
|
"matrix_client",
|
||||||
|
@ -73,28 +70,5 @@ setuptools_info = dict(
|
||||||
"click",
|
"click",
|
||||||
"typing_extensions>=3.7",
|
"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 types
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from configparser import SafeConfigParser
|
from configparser import SafeConfigParser
|
||||||
from distutils.version import LooseVersion
|
|
||||||
from typing import (
|
from typing import (
|
||||||
IO,
|
IO,
|
||||||
Any,
|
Any,
|
||||||
|
@ -37,9 +36,6 @@ assert sys.version_info >= (3, 6)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
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
|
# In newer versions, the 'json' attribute is a function, not a property
|
||||||
requests_json_is_function = callable(requests.Response.json)
|
requests_json_is_function = callable(requests.Response.json)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
from setuptools import find_packages, setup
|
||||||
import sys
|
|
||||||
from typing import Any, Dict, Optional
|
|
||||||
|
|
||||||
ZULIP_BOTS_VERSION = "0.8.1"
|
ZULIP_BOTS_VERSION = "0.8.1"
|
||||||
IS_PYPA_PACKAGE = False
|
IS_PYPA_PACKAGE = False
|
||||||
|
@ -21,8 +19,7 @@ if not IS_PYPA_PACKAGE:
|
||||||
with open("README.md") as fh:
|
with open("README.md") as fh:
|
||||||
long_description = fh.read()
|
long_description = fh.read()
|
||||||
|
|
||||||
# We should be installable with either setuptools or distutils.
|
setup(
|
||||||
package_info = dict(
|
|
||||||
name="zulip_bots",
|
name="zulip_bots",
|
||||||
version=ZULIP_BOTS_VERSION,
|
version=ZULIP_BOTS_VERSION,
|
||||||
description="Zulip's Bot framework",
|
description="Zulip's Bot framework",
|
||||||
|
@ -54,9 +51,6 @@ package_info = dict(
|
||||||
"zulip-bot-shell=zulip_bots.bot_shell:main",
|
"zulip-bot-shell=zulip_bots.bot_shell:main",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
) # type: Dict[str, Any]
|
|
||||||
|
|
||||||
setuptools_info = dict(
|
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"pip",
|
"pip",
|
||||||
"zulip",
|
"zulip",
|
||||||
|
@ -66,47 +60,6 @@ setuptools_info = dict(
|
||||||
"typing_extensions",
|
"typing_extensions",
|
||||||
'importlib-metadata >= 3.6; python_version < "3.10"',
|
'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
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import sys
|
from setuptools import find_packages, setup
|
||||||
from typing import Any, Dict, Optional
|
|
||||||
|
|
||||||
ZULIP_BOTSERVER_VERSION = "0.8.1"
|
ZULIP_BOTSERVER_VERSION = "0.8.1"
|
||||||
|
|
||||||
with open("README.md") as fh:
|
with open("README.md") as fh:
|
||||||
long_description = fh.read()
|
long_description = fh.read()
|
||||||
|
|
||||||
# We should be installable with either setuptools or distutils.
|
setup(
|
||||||
package_info = dict(
|
|
||||||
name="zulip_botserver",
|
name="zulip_botserver",
|
||||||
version=ZULIP_BOTSERVER_VERSION,
|
version=ZULIP_BOTSERVER_VERSION,
|
||||||
description="Zulip's Flask server for running bots",
|
description="Zulip's Flask server for running bots",
|
||||||
|
@ -42,48 +40,10 @@ package_info = dict(
|
||||||
},
|
},
|
||||||
test_suite="tests",
|
test_suite="tests",
|
||||||
package_data={"zulip_botserver": ["py.typed"]},
|
package_data={"zulip_botserver": ["py.typed"]},
|
||||||
) # type: Dict[str, Any]
|
|
||||||
|
|
||||||
setuptools_info = dict(
|
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"zulip",
|
"zulip",
|
||||||
"zulip_bots",
|
"zulip_bots",
|
||||||
"flask>=0.12.2",
|
"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