[7.x] Add .ci/make.sh script for building releases
Co-authored-by: Seth Michael Larson <seth.larson@elastic.co>
This commit is contained in:
committed by
GitHub
parent
f6d2da6740
commit
9b8cee0199
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
BASE_DIR="$( dirname "$BASE_DIR" )"
|
||||
|
||||
if [[ "$1" != "release" ]]; then
|
||||
echo "Must be called ./.ci/make.sh release [version]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python $BASE_DIR/utils/build_dists.py
|
||||
mkdir -p $BASE_DIR/.ci/output
|
||||
cp $BASE_DIR/dist/* $BASE_DIR/.ci/output/
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
python3.7 -m pip install setuptools wheel twine
|
||||
- name: Build packages
|
||||
run: |
|
||||
python3.7 setup.py sdist bdist_wheel
|
||||
python3.7 utils/build_dists.py
|
||||
- name: Check packages
|
||||
run: |
|
||||
set -exo pipefail;
|
||||
|
||||
+2
-1
@@ -142,4 +142,5 @@ cython_debug/
|
||||
|
||||
# elasticsearch files
|
||||
test_elasticsearch/cover
|
||||
test_elasticsearch/local.py
|
||||
test_elasticsearch/local.py
|
||||
.ci/output
|
||||
|
||||
@@ -18,14 +18,18 @@
|
||||
# flake8: noqa
|
||||
from __future__ import absolute_import
|
||||
|
||||
VERSION = (7, 10, 0)
|
||||
__version__ = VERSION
|
||||
__versionstr__ = "7.10.0.dev0"
|
||||
__versionstr__ = "7.10.0+dev"
|
||||
|
||||
import re
|
||||
import sys
|
||||
import logging
|
||||
import warnings
|
||||
|
||||
_major, _minor, _patch = [
|
||||
int(x) for x in re.search(r"^(\d+)\.(\d+)\.(\d+)", __versionstr__).groups()
|
||||
]
|
||||
VERSION = __version__ = (_major, _minor, _patch)
|
||||
|
||||
logger = logging.getLogger("elasticsearch")
|
||||
logger.addHandler(logging.NullHandler())
|
||||
|
||||
|
||||
@@ -16,16 +16,27 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from os.path import join, dirname
|
||||
import re
|
||||
from os.path import abspath, join, dirname
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
VERSION = (7, 10, 0)
|
||||
__version__ = VERSION
|
||||
__versionstr__ = "7.10.0.dev0"
|
||||
package_name = "elasticsearch"
|
||||
base_dir = abspath(dirname(__file__))
|
||||
|
||||
with open(join(dirname(__file__), "README")) as f:
|
||||
with open(join(base_dir, package_name, "__init__.py")) as f:
|
||||
package_version = re.search(
|
||||
r"__versionstr__\s+=\s+[\"\']([^\"\']+)[\"\']", f.read()
|
||||
).group(1)
|
||||
|
||||
with open(join(base_dir, "README")) as f:
|
||||
long_description = f.read().strip()
|
||||
|
||||
packages = [
|
||||
package
|
||||
for package in find_packages(where=".", exclude=("test_elasticsearch*",))
|
||||
if package == package_name or package.startswith(package_name + ".")
|
||||
]
|
||||
|
||||
install_requires = [
|
||||
"urllib3>=1.21.1",
|
||||
"certifi",
|
||||
@@ -44,13 +55,13 @@ docs_require = ["sphinx<1.7", "sphinx_rtd_theme"]
|
||||
generate_require = ["black", "jinja2"]
|
||||
|
||||
setup(
|
||||
name="elasticsearch",
|
||||
name=package_name,
|
||||
description="Python client for Elasticsearch",
|
||||
license="Apache-2.0",
|
||||
url="https://github.com/elastic/elasticsearch-py",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/x-rst",
|
||||
version=__versionstr__,
|
||||
version=package_version,
|
||||
author="Honza Král, Nick Lang",
|
||||
author_email="honza.kral@gmail.com, nick@nicklang.com",
|
||||
maintainer="Seth Michael Larson",
|
||||
@@ -60,7 +71,7 @@ setup(
|
||||
"Source Code": "https://github.com/elastic/elasticsearch-py",
|
||||
"Issue Tracker": "https://github.com/elastic/elasticsearch-py/issues",
|
||||
},
|
||||
packages=find_packages(where=".", exclude=("test_elasticsearch*",)),
|
||||
packages=packages,
|
||||
package_data={"elasticsearch": ["py.typed"]},
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
|
||||
@@ -127,12 +127,15 @@ def test_dist(dist):
|
||||
|
||||
|
||||
def main():
|
||||
run("git", "checkout", "--", "setup.py", "elasticsearch/")
|
||||
run("rm", "-rf", "build/", "dist/", "*.egg-info", ".eggs")
|
||||
|
||||
# Grab the major version to be used as a suffix.
|
||||
setup_py_path = os.path.join(base_dir, "setup.py")
|
||||
with open(setup_py_path) as f:
|
||||
major_version = re.search(r"^VERSION = \((\d+),", f.read(), re.M).group(1)
|
||||
with open(os.path.join(base_dir, "elasticsearch/__init__.py")) as f:
|
||||
major_version = re.search(
|
||||
r"^__versionstr__\s+=\s+[\"\'](\d+)\.", f.read(), re.M
|
||||
).group(1)
|
||||
|
||||
for suffix in ("", major_version):
|
||||
run("rm", "-rf", "build/", "*.egg-info", ".eggs")
|
||||
@@ -148,9 +151,11 @@ def main():
|
||||
setup_py = f.read()
|
||||
with open(setup_py_path, "w") as f:
|
||||
f.truncate()
|
||||
assert 'package_name = "elasticsearch"' in setup_py
|
||||
f.write(
|
||||
setup_py.replace(
|
||||
'name="elasticsearch",', 'name="elasticsearch%s",' % suffix
|
||||
'package_name = "elasticsearch"',
|
||||
'package_name = "elasticsearch%s"' % suffix,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user