potiuk commented on a change in pull request #7391: [AIRFLOW-6663] Prepare backporting packages URL: https://github.com/apache/airflow/pull/7391#discussion_r382963718
########## File path: backport_packages/setup_backport_packages.py ########## @@ -0,0 +1,251 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""Setup.py for the Backport packages of Airflow project.""" + +import io +import itertools +import logging +import os +import sys +import textwrap +from importlib import util +from os.path import dirname +from shutil import copytree, rmtree +from typing import List + +from setuptools import Command, find_packages, setup as setuptools_setup + +sys.path.append(os.path.join(dirname(__file__), os.pardir)) + + +logger = logging.getLogger(__name__) + +# Kept manually in sync with airflow.__version__ +# noinspection PyUnresolvedReferences +spec = util.spec_from_file_location("airflow.version", os.path.join('airflow', 'version.py')) +# noinspection PyUnresolvedReferences +mod = util.module_from_spec(spec) +spec.loader.exec_module(mod) # type: ignore +version = mod.version # type: ignore + +PY3 = sys.version_info[0] == 3 + +# noinspection PyUnboundLocalVariable +try: + with io.open('README.md', encoding='utf-8') as f: + long_description = f.read() +except FileNotFoundError: + long_description = '' + + +class CleanCommand(Command): + """ + Command to tidy up the project root. + Registered as cmdclass in setup() so it can be called with ``python setup.py extra_clean``. + """ + + description = "Tidy up the project root" + user_options = [] # type: List[str] + + def initialize_options(self): + """Set default values for options.""" + + def finalize_options(self): + """Set final values for options.""" + + # noinspection PyMethodMayBeStatic + def run(self): + """Run command to remove temporary files and directories.""" + os.chdir(dirname(__file__)) + os.system('rm -vrf ./build ./dist ./*.pyc ./*.tgz ./*.egg-info') + + +def get_providers_dependencies(): + import setup # From AIRFLOW_SOURCES/setup.py + + return { + "amazon": [setup.aws], + "apache.cassandra": [setup.cassandra], + "apache.druid": [setup.druid], + "apache.hdfs": [setup.hdfs], + "apache.hive": [setup.hive], + "apache.pig": [], + "apache.pinot": [setup.pinot], + "apache.spark": [], + "apache.sqoop": [], + "celery": [setup.celery], + "cloudant": [setup.cloudant], + "cncf.kubernetes": [setup.kubernetes], + "databricks": [setup.databricks], + "datadog": [setup.datadog], + "dingding": [], + "discord": [], + "docker": [setup.docker], + "email": [], + "ftp": [], + "google.cloud": [setup.gcp], + "google.marketing_platform": [setup.gcp], + "google.suite": [setup.gcp], + "grpc": [setup.grpc], + "http": [], + "imap": [], + "jdbc": [setup.jdbc], + "jenkins": [setup.jenkins], + "jira": [setup.jira], + "microsoft.azure": [setup.azure], + "microsoft.mssql": [setup.mssql], + "microsoft.winrm": [setup.winrm], + "mongo": [setup.mongo], + "mysql": [setup.mysql], + "odbc": [setup.odbc], + "openfass": [], + "opsgenie": [], + "oracle": [setup.oracle], + "pagerduty": [setup.pagerduty], + "papermill": [setup.papermill], + "postgres": [setup.postgres], + "presto": [setup.presto], + "qubole": [setup.qds], + "redis": [setup.redis], + "salesforce": [setup.salesforce], + "samba": [setup.samba], + "segment": [setup.segment], + "sftp": [setup.ssh], + "slack": [setup.slack], + "snowflake": [setup.snowflake], + "sqlite": [], + "ssh": [setup.ssh], + "vertica": [setup.vertica], + "zendesk": [setup.zendesk], + } + + +PROVIDERS_DEPENDENCIES = get_providers_dependencies() + + +def copy_provider_sources(): + build_dir = os.path.join(dirname(__file__), "build") + if os.path.isdir(build_dir): + rmtree(build_dir) + package_providers_dir = os.path.join(dirname(__file__), "airflow", "providers") + if os.path.isdir(package_providers_dir): + rmtree(package_providers_dir) + copytree(os.path.join(*[dirname(__file__), os.pardir, "airflow", "providers"]), Review comment: indeed! ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
