From e17f65e617e582287d287c558e0acb2df343ea00 Mon Sep 17 00:00:00 2001 From: "Edwin Marshall (aspidites)" Date: Mon, 23 Jul 2012 23:02:22 -0500 Subject: [PATCH] - made logic for testing environ variables more accurate - kivy more robust when checking for build scripts --- kivy/__init__.py | 9 +++++---- kivy/config.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/kivy/__init__.py b/kivy/__init__.py index cf1f3a60f..53592a838 100644 --- a/kivy/__init__.py +++ b/kivy/__init__.py @@ -234,13 +234,14 @@ kivy_userexts_dir = '' # Don't go further if we generate documentation -if basename(sys.argv[0]) in ('sphinx-build', 'autobuild.py'): +if any(name in sys.argv[0] for name in ('sphinx-build', 'autobuild.py')): environ['KIVY_DOC'] = '1' -if basename(sys.argv[0]) in ('sphinx-build', ): +if 'sphinx-build' in sys.argv[0]: environ['KIVY_DOC_INCLUDE'] = '1' -if basename(sys.argv[0]) in ('nosetests', ) or 'nosetests' in sys.argv: +if any('nosetests' in arg for arg in sys.argv): environ['KIVY_UNITTEST'] = '1' -if not 'KIVY_DOC_INCLUDE' in environ: + +if not environ.get('KIVY_DOC_INCLUDE'): # Configuration management user_home_dir = expanduser('~') if platform() == 'android': diff --git a/kivy/config.py b/kivy/config.py index 1c7280222..d1b20e5e9 100644 --- a/kivy/config.py +++ b/kivy/config.py @@ -255,7 +255,7 @@ class ConfigParser(PythonConfigParser): return True -if not 'KIVY_DOC_INCLUDE' in environ: +if not environ.get('KIVY_DOC_INCLUDE'): # # Read, analyse configuration file