From fdab870c8abc4082af7042c382fb61419bbe9a90 Mon Sep 17 00:00:00 2001 From: Ferenc Csaky Date: Wed, 31 Jan 2024 16:23:40 +0100 Subject: [PATCH] Include connector JAR in Py package --- flink-python/pom.xml | 2 +- flink-python/setup.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/flink-python/pom.xml b/flink-python/pom.xml index 08a55830..b1a21f52 100644 --- a/flink-python/pom.xml +++ b/flink-python/pom.xml @@ -39,7 +39,7 @@ under the License. org.apache.flink flink-connector-cassandra_${scala.binary.version} ${project.version} - test + provided org.slf4j diff --git a/flink-python/setup.py b/flink-python/setup.py index 0d99f8f7..1b1e9d00 100644 --- a/flink-python/setup.py +++ b/flink-python/setup.py @@ -17,12 +17,13 @@ ################################################################################ from __future__ import print_function +import glob import io import os import sys from setuptools import setup -from shutil import rmtree +from shutil import copy, rmtree from xml.etree import ElementTree as ET PACKAGE_NAME = 'apache-flink-connector-aws' @@ -35,6 +36,7 @@ VERSION_FILE = os.path.join( CURRENT_DIR, 'pyflink/datastream/connectors/cassandra_connector_version.py') +LIB_PATH = os.path.join(CURRENT_DIR, 'pyflink/lib') DEPENDENCY_FILE = os.path.join(CURRENT_DIR, 'dev/dev-requirements.txt') @@ -82,6 +84,11 @@ def prepare_pyflink_dir(): flink_dependency = "apache-flink>=" + flink_version + os.makedirs(LIB_PATH) + connector_jar = \ + glob.glob(CURRENT_DIR + '/target/test-dependencies/flink-connector-cassandra*.jar')[0] + copy(connector_jar, LIB_PATH) + with io.open(VERSION_FILE, 'w', encoding='utf-8') as f: f.write('# Generated file, do not edit\n') f.write('__connector_version__ = "' + connector_version + '"\n') @@ -111,6 +118,7 @@ def prepare_pyflink_dir(): if in_flink_source: remove_if_exists(VERSION_FILE) remove_if_exists(DEPENDENCY_FILE) + remove_if_exists(LIB_PATH) prepare_pyflink_dir() print("\nPreparing Flink Cassandra connector package")