From a771c637d70c2204c5716fd86b98948ccfa91c88 Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Wed, 4 Dec 2019 14:23:53 -0700 Subject: [PATCH 1/2] fail more gracefully when setuptools is missing --- core/setup.py | 13 +++++++++++-- plugins/bigquery/setup.py | 14 ++++++++++++-- plugins/postgres/setup.py | 14 ++++++++++++-- plugins/redshift/setup.py | 13 +++++++++++-- plugins/snowflake/setup.py | 14 ++++++++++++-- 5 files changed, 58 insertions(+), 10 deletions(-) diff --git a/core/setup.py b/core/setup.py index 61e2a5a8189..cc5a130e543 100644 --- a/core/setup.py +++ b/core/setup.py @@ -1,7 +1,16 @@ #!/usr/bin/env python -from setuptools import find_namespace_packages -from setuptools import setup import os +import sys + +from setuptools import setup +try: + from setuptools import find_namespace_packages +except ImportError: + # the user has a downlevel version of setuptools. + print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Please upgrade setuptools with "pip install --upgrade setuptools" ' + 'and try again') + sys.exit(1) def read(fname): diff --git a/plugins/bigquery/setup.py b/plugins/bigquery/setup.py index 1a14db7b899..3dd31af2cca 100644 --- a/plugins/bigquery/setup.py +++ b/plugins/bigquery/setup.py @@ -1,7 +1,17 @@ #!/usr/bin/env python -from setuptools import find_namespace_packages -from setuptools import setup import os +import sys + +from setuptools import setup +try: + from setuptools import find_namespace_packages +except ImportError: + # the user has a downlevel version of setuptools. + print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Please upgrade setuptools with "pip install --upgrade setuptools" ' + 'and try again') + sys.exit(1) + package_name = "dbt-bigquery" package_version = "0.15.0" diff --git a/plugins/postgres/setup.py b/plugins/postgres/setup.py index dbe4b56f7a8..b662b8beeb3 100644 --- a/plugins/postgres/setup.py +++ b/plugins/postgres/setup.py @@ -1,7 +1,17 @@ #!/usr/bin/env python -from setuptools import find_namespace_packages -from setuptools import setup import os +import sys + +from setuptools import setup +try: + from setuptools import find_namespace_packages +except ImportError: + # the user has a downlevel version of setuptools. + print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Please upgrade setuptools with "pip install --upgrade setuptools" ' + 'and try again') + sys.exit(1) + PSYCOPG2_MESSAGE = ''' No package name override was set. diff --git a/plugins/redshift/setup.py b/plugins/redshift/setup.py index 9c62cee7345..844e88911d1 100644 --- a/plugins/redshift/setup.py +++ b/plugins/redshift/setup.py @@ -1,7 +1,16 @@ #!/usr/bin/env python -from setuptools import find_namespace_packages -from setuptools import setup import os +import sys + +from setuptools import setup +try: + from setuptools import find_namespace_packages +except ImportError: + # the user has a downlevel version of setuptools. + print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Please upgrade setuptools with "pip install --upgrade setuptools" ' + 'and try again') + sys.exit(1) package_name = "dbt-redshift" diff --git a/plugins/snowflake/setup.py b/plugins/snowflake/setup.py index caa82264561..f13e1f9ef02 100644 --- a/plugins/snowflake/setup.py +++ b/plugins/snowflake/setup.py @@ -1,7 +1,17 @@ #!/usr/bin/env python -from setuptools import find_namespace_packages -from setuptools import setup import os +import sys + +from setuptools import setup +try: + from setuptools import find_namespace_packages +except ImportError: + # the user has a downlevel version of setuptools. + print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Please upgrade setuptools with "pip install --upgrade setuptools" ' + 'and try again') + sys.exit(1) + package_name = "dbt-snowflake" package_version = "0.15.0" From 3dff3e71bceb91eae52848b92d55f474f11bc181 Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Thu, 5 Dec 2019 14:20:24 -0700 Subject: [PATCH 2/2] PR feedback --- core/setup.py | 2 +- plugins/bigquery/setup.py | 2 +- plugins/postgres/setup.py | 2 +- plugins/redshift/setup.py | 2 +- plugins/snowflake/setup.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/setup.py b/core/setup.py index cc5a130e543..399d6ec74f3 100644 --- a/core/setup.py +++ b/core/setup.py @@ -7,7 +7,7 @@ from setuptools import find_namespace_packages except ImportError: # the user has a downlevel version of setuptools. - print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Error: dbt requires setuptools v40.1.0 or higher.') print('Please upgrade setuptools with "pip install --upgrade setuptools" ' 'and try again') sys.exit(1) diff --git a/plugins/bigquery/setup.py b/plugins/bigquery/setup.py index 3dd31af2cca..57852901049 100644 --- a/plugins/bigquery/setup.py +++ b/plugins/bigquery/setup.py @@ -7,7 +7,7 @@ from setuptools import find_namespace_packages except ImportError: # the user has a downlevel version of setuptools. - print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Error: dbt requires setuptools v40.1.0 or higher.') print('Please upgrade setuptools with "pip install --upgrade setuptools" ' 'and try again') sys.exit(1) diff --git a/plugins/postgres/setup.py b/plugins/postgres/setup.py index b662b8beeb3..89d86788902 100644 --- a/plugins/postgres/setup.py +++ b/plugins/postgres/setup.py @@ -7,7 +7,7 @@ from setuptools import find_namespace_packages except ImportError: # the user has a downlevel version of setuptools. - print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Error: dbt requires setuptools v40.1.0 or higher.') print('Please upgrade setuptools with "pip install --upgrade setuptools" ' 'and try again') sys.exit(1) diff --git a/plugins/redshift/setup.py b/plugins/redshift/setup.py index 844e88911d1..d241e9409b6 100644 --- a/plugins/redshift/setup.py +++ b/plugins/redshift/setup.py @@ -7,7 +7,7 @@ from setuptools import find_namespace_packages except ImportError: # the user has a downlevel version of setuptools. - print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Error: dbt requires setuptools v40.1.0 or higher.') print('Please upgrade setuptools with "pip install --upgrade setuptools" ' 'and try again') sys.exit(1) diff --git a/plugins/snowflake/setup.py b/plugins/snowflake/setup.py index f13e1f9ef02..a060ae13e28 100644 --- a/plugins/snowflake/setup.py +++ b/plugins/snowflake/setup.py @@ -7,7 +7,7 @@ from setuptools import find_namespace_packages except ImportError: # the user has a downlevel version of setuptools. - print('Error: dbt requires v40.1.0 or higher of setuptools.') + print('Error: dbt requires setuptools v40.1.0 or higher.') print('Please upgrade setuptools with "pip install --upgrade setuptools" ' 'and try again') sys.exit(1)