81073f9234
This commit adds a script to automate the PyPA release of the zulip, zulip_bots and zulip_botserver packages. The tools/release-packages script would take care of uploading the packages to PyPA, and push commits to both repos updating the package versions. If you have commit access to the repos, you can --push upstream to master. If not, then you can --push origin to a new branch on your fork and create a PR for those changes. Ideally, a release shouldn't take longer than however long it takes one to type the above command. If you have SSH set up on GitHub, you won't need to type in your GitHub username and password. You can also store your PyPA credentials in a file in your home directory; it isn't very secure, but it saves time nevertheless.
93 lines
2.7 KiB
Python
Executable file
93 lines
2.7 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import print_function
|
|
|
|
import os
|
|
import sys
|
|
|
|
import generate_manifest
|
|
|
|
ZULIP_BOTS_VERSION = "0.3.4"
|
|
IS_PYPA_PACKAGE = False
|
|
|
|
# IS_PYPA_PACKAGE is set to True by tools/release-packages
|
|
# before making a PyPA release.
|
|
if not IS_PYPA_PACKAGE:
|
|
generate_manifest.generate_dev_manifest()
|
|
|
|
# We should be installable with either setuptools or distutils.
|
|
package_info = dict(
|
|
name='zulip_bots',
|
|
version=ZULIP_BOTS_VERSION,
|
|
description='Zulip\'s Bot framework',
|
|
author='Zulip Open Source Project',
|
|
author_email='zulip-devel@googlegroups.com',
|
|
classifiers=[
|
|
'Development Status :: 4 - Beta',
|
|
'Environment :: Web Environment',
|
|
'Intended Audience :: Developers',
|
|
'License :: OSI Approved :: MIT License',
|
|
'Topic :: Communications :: Chat',
|
|
],
|
|
url='https://www.zulip.org/',
|
|
entry_points={
|
|
'console_scripts': [
|
|
'zulip-run-bot=zulip_bots.run:main',
|
|
'zulip-bot-output=zulip_bots.zulip_bot_output:main'
|
|
],
|
|
},
|
|
include_package_data=True,
|
|
cmdclass={
|
|
'gen_manifest': generate_manifest.GenerateManifest,
|
|
},
|
|
) # type: Dict[str, Any]
|
|
|
|
setuptools_info = dict(
|
|
install_requires=[
|
|
'zulip',
|
|
'mock>=2.0.0',
|
|
'html2text', # for bots/define
|
|
],
|
|
)
|
|
|
|
try:
|
|
from setuptools import setup, find_packages
|
|
package_info.update(setuptools_info)
|
|
package_info['packages'] = find_packages()
|
|
|
|
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, version=None):
|
|
try:
|
|
module = import_module(module_name)
|
|
if version is not None:
|
|
assert(LooseVersion(module.__version__) >= LooseVersion(version))
|
|
except (ImportError, AssertionError):
|
|
if version is not None:
|
|
print("{name}>={version} is not installed.".format(
|
|
req=req, version=version), file=sys.stderr)
|
|
else:
|
|
print("{name} is not installed.".format(name=module_name), 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)
|