Skip to content

Commit c37fc0b

Browse files
authored
[AIRFLOW-2817] Force explicit choice on GPL dependency (apache#3660)
By default one of Apache Airflow's dependencies pulls in a GPL library. Airflow should not install (and upgrade) without an explicit choice. This is part of the Apache requirements as we cannot depend on Category X software.
1 parent c26c564 commit c37fc0b

File tree

6 files changed

+51
-11
lines changed

6 files changed

+51
-11
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ python:
4646
- "3.5"
4747
env:
4848
global:
49+
- SLUGIFY_USES_TEXT_UNIDECODE=yes
4950
- TRAVIS_CACHE=$HOME/.travis_cache/
5051
- KRB5_CONFIG=/etc/krb5.conf
5152
- KRB5_KTNAME=/etc/airflow.keytab

INSTALL

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
1-
# INSTALL / BUILD instruction for Apache Airflow (incubating)
2-
# fetch the tarball and untar the source
1+
# INSTALL / BUILD instructions for Apache Airflow (incubating)
2+
3+
# [required] fetch the tarball and untar the source
4+
# change into the directory that was untarred.
35

46
# [optional] run Apache RAT (release audit tool) to validate license headers
5-
# RAT docs here: https://creadur.apache.org/rat/
7+
# RAT docs here: https://creadur.apache.org/rat/. Requires Java and Apache Rat
68
java -jar apache-rat.jar -E ./.rat-excludes -d .
79

8-
# [optional] by default one of Apache Airflow's dependencies pulls in a GPL
9-
# library. If this is a concern issue (also every upgrade):
10-
# export SLUGIFY_USES_TEXT_UNIDECODE=yes
10+
# [optional] Airflow pulls in quite a lot of dependencies in order
11+
# to connect to other services. You might want to test or run Airflow
12+
# from a virtual env to make sure those dependencies are separated
13+
# from your system wide versions
14+
python -m my_env
15+
source my_env/bin/activate
16+
17+
# [required] by default one of Apache Airflow's dependencies pulls in a GPL
18+
# library. Airflow will not install (and upgrade) without an explicit choice.
19+
#
20+
# To make sure not to install the GPL dependency:
21+
# export SLUGIFY_USES_TEXT_UNIDECODE=yes
22+
# In case you do not mind:
23+
# export GPL_UNIDECODE=yes
24+
25+
# [required] building and installing
26+
# by pip (preferred)
27+
pip install .
1128

12-
# install the release
29+
# or directly
1330
python setup.py install

UPDATING.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ assists users migrating to a new version.
55

66
## Airflow Master
77

8+
## Airflow 1.10
9+
10+
Installation and upgrading requires setting `SLUGIFY_USES_TEXT_UNIDECODE=yes` in your environment or
11+
`AIRFLOW_GPL_UNIDECODE=yes`. In case of the latter a GPL runtime dependency will be installed due to a
12+
dependency (python-nvd3 -> python-slugify -> unidecode).
13+
814
### Replace DataProcHook.await calls to DataProcHook.wait
915

1016
The method name was changed to be compatible with the Python 3.7 async/await keywords

scripts/ci/kubernetes/docker/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
FROM ubuntu:16.04
1919

20+
ENV SLUGIFY_USES_TEXT_UNIDECODE=yes
21+
2022
# install deps
2123
RUN apt-get update -y && apt-get install -y \
2224
wget \
@@ -33,7 +35,6 @@ RUN apt-get update -y && apt-get install -y \
3335
unzip \
3436
&& apt-get clean
3537

36-
3738
RUN pip install --upgrade pip
3839

3940
# Since we install vanilla Airflow, we also want to have support for Postgres and Kubernetes

setup.py

+14
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@
3535
PY3 = sys.version_info[0] == 3
3636

3737

38+
# See LEGAL-362
39+
def verify_gpl_dependency():
40+
if (not os.getenv("AIRFLOW_GPL_UNIDECODE")
41+
and not os.getenv("SLUGIFY_USES_TEXT_UNIDECODE") == "yes"):
42+
raise RuntimeError("By default one of Airflow's dependencies installs a GPL "
43+
"dependency (unidecode). To avoid this dependency set "
44+
"SLUGIFY_USES_TEXT_UNIDECODE=yes in your environment when you "
45+
"install or upgrade Airflow. To force installing the GPL "
46+
"version set AIRFLOW_GPL_UNIDECODE")
47+
48+
3849
class Tox(TestCommand):
3950
user_options = [('tox-args=', None, "Arguments to pass to tox")]
4051

@@ -258,6 +269,7 @@ def write_version(filename=os.path.join(*['airflow',
258269

259270

260271
def do_setup():
272+
verify_gpl_dependency()
261273
write_version()
262274
setup(
263275
name='apache-airflow',
@@ -376,6 +388,7 @@ def do_setup():
376388
'License :: OSI Approved :: Apache Software License',
377389
'Programming Language :: Python :: 2.7',
378390
'Programming Language :: Python :: 3.4',
391+
'Programming Language :: Python :: 3.5',
379392
'Topic :: System :: Monitoring',
380393
],
381394
author='Apache Software Foundation',
@@ -388,6 +401,7 @@ def do_setup():
388401
'extra_clean': CleanCommand,
389402
'compile_assets': CompileAssets
390403
},
404+
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
391405
)
392406

393407

tox.ini

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# to you under the Apache License, Version 2.0 (the
77
# "License"); you may not use this file except in compliance
88
# with the License. You may obtain a copy of the License at
9-
#
9+
#
1010
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
11+
#
1212
# Unless required by applicable law or agreed to in writing,
1313
# software distributed under the License is distributed on an
1414
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -28,7 +28,7 @@ find_links =
2828

2929
[flake8]
3030
max-line-length = 90
31-
ignore = E731
31+
ignore = E731,W503
3232

3333
[testenv]
3434
deps =
@@ -64,6 +64,7 @@ passenv =
6464
BOTO_CONFIG
6565
KRB5_CONFIG
6666
KRB5_KTNAME
67+
SLUGIFY_USES_TEXT_UNIDECODE
6768

6869
commands =
6970
pip wheel -w {homedir}/.wheelhouse -f {homedir}/.wheelhouse -e .[devel_ci]

0 commit comments

Comments
 (0)