Skip to content

Commit

Permalink
[FLINK-22095][python] Remove bundled licenses in apache-flink distrib…
Browse files Browse the repository at this point in the history
…uted package

This closes apache#15478
  • Loading branch information
HuangXingBo committed Apr 2, 2021
1 parent 5c43291 commit 69d9bce
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
1 change: 0 additions & 1 deletion flink-python/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ graft deps/bin
graft deps/conf
graft deps/log
recursive-include deps/examples *.py
graft deps/licenses
include README.md
include LICENSE
include NOTICE
Expand Down
2 changes: 1 addition & 1 deletion flink-python/apache-flink-libraries/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def find_file_path(pattern):
# regenerate the licenses directory and NOTICE file as we only copy part of the
# flink binary distribution.
collect_licenses_file_sh = os.path.abspath(os.path.join(
this_directory, "..", "tools", "releasing", "collect_license_files.sh"))
this_directory, "..", "..", "tools", "releasing", "collect_license_files.sh"))
subprocess.check_output([collect_licenses_file_sh, TEMP_PATH, TEMP_PATH])
# move the NOTICE file to the root of the package
GENERATED_NOTICE_FILE_PATH = os.path.join(TEMP_PATH, "NOTICE")
Expand Down
26 changes: 0 additions & 26 deletions flink-python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import io
import os
import platform
import subprocess
import sys
from distutils.command.build_ext import build_ext
from shutil import copytree, copy, rmtree
Expand Down Expand Up @@ -189,21 +188,15 @@ def extracted_output_files(base_dir, file_path, output_directory):
CONF_TEMP_PATH = os.path.join(TEMP_PATH, "conf")
LOG_TEMP_PATH = os.path.join(TEMP_PATH, "log")
EXAMPLES_TEMP_PATH = os.path.join(TEMP_PATH, "examples")
LICENSES_TEMP_PATH = os.path.join(TEMP_PATH, "licenses")
SCRIPTS_TEMP_PATH = os.path.join(TEMP_PATH, "bin")

LICENSE_FILE_TEMP_PATH = os.path.join(this_directory, "LICENSE")
NOTICE_FILE_TEMP_PATH = os.path.join(this_directory, "NOTICE")
README_FILE_TEMP_PATH = os.path.join("pyflink", "README.txt")
PYFLINK_UDF_RUNNER_SH = "pyflink-udf-runner.sh"
PYFLINK_UDF_RUNNER_BAT = "pyflink-udf-runner.bat"

in_flink_source = os.path.isfile("../flink-java/src/main/java/org/apache/flink/api/java/"
"ExecutionEnvironment.java")

# Due to changes in FLINK-14008, the licenses directory and NOTICE file may not exist in
# build-target folder. Just ignore them in this case.
exist_licenses = None
try:
if in_flink_source:

Expand All @@ -221,13 +214,10 @@ def extracted_output_files(base_dir, file_path, output_directory):
FLINK_BIN = os.path.join(FLINK_DIST, "src/main/flink-bin")

EXAMPLES_PATH = os.path.join(this_directory, "pyflink/table/examples")
LICENSES_PATH = os.path.join(FLINK_HOME, "licenses")

LICENSE_FILE_PATH = os.path.join(FLINK_ROOT, "LICENSE")
README_FILE_PATH = os.path.join(FLINK_BIN, "README.txt")

exist_licenses = os.path.exists(LICENSES_PATH)

FLINK_BIN_XML_FILE = os.path.join(FLINK_BIN, '../assemblies/bin.xml')
# copy conf files
os.mkdir(CONF_TEMP_PATH)
Expand Down Expand Up @@ -256,22 +246,12 @@ def extracted_output_files(base_dir, file_path, output_directory):
f.write("This file is used to force setuptools to include the log directory. "
"You can delete it at any time after installation.")

if exist_licenses and platform.system() != "Windows":
# regenerate the licenses directory and NOTICE file as we only copy part of the
# flink binary distribution.
collect_licenses_file_sh = os.path.abspath(os.path.join(
this_directory, "..", "tools", "releasing", "collect_license_files.sh"))
subprocess.check_output([collect_licenses_file_sh, TEMP_PATH, TEMP_PATH])
# move the NOTICE file to the root of the package
GENERATED_NOTICE_FILE_PATH = os.path.join(TEMP_PATH, "NOTICE")
os.rename(GENERATED_NOTICE_FILE_PATH, NOTICE_FILE_TEMP_PATH)
else:
if not os.path.isdir(SCRIPTS_TEMP_PATH):
print("The flink core files are not found. Please make sure your installation package "
"is complete, or do this in the flink-python directory of the flink source "
"directory.")
sys.exit(-1)
exist_licenses = os.path.exists(LICENSES_TEMP_PATH)
if VERSION.find('dev0') != -1:
apache_flink_libraries_dependency = 'apache-flink-libraries==%s' % VERSION
else:
Expand Down Expand Up @@ -315,11 +295,6 @@ def extracted_output_files(base_dir, file_path, output_directory):
'pyflink.examples': ['*.py', '*/*.py'],
'pyflink.bin': ['*']}

if exist_licenses and platform.system() != "Windows":
PACKAGES.append('pyflink.licenses')
PACKAGE_DIR['pyflink.licenses'] = TEMP_PATH + '/licenses'
PACKAGE_DATA['pyflink.licenses'] = ['*']

setup(
name='apache-flink',
version=VERSION,
Expand Down Expand Up @@ -356,5 +331,4 @@ def extracted_output_files(base_dir, file_path, output_directory):
if in_flink_source:
remove_if_exists(TEMP_PATH)
remove_if_exists(LICENSE_FILE_TEMP_PATH)
remove_if_exists(NOTICE_FILE_TEMP_PATH)
remove_if_exists(README_FILE_TEMP_PATH)

0 comments on commit 69d9bce

Please sign in to comment.