From e805c345e2d7708f7094639d7d40e18f0f5fa92c Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Wed, 27 Feb 2019 11:25:45 +0300 Subject: [PATCH] Extract cache directory name in a constant GitOrigin-RevId: 0b1fecbbae5032d34cb81c683154fdf5d1860987 --- python/helpers/generator3.py | 2 +- python/helpers/pycharm_generator_utils/constants.py | 3 +++ python/helpers/pycharm_generator_utils/test/test_generation.py | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/python/helpers/generator3.py b/python/helpers/generator3.py index bbd2f210e3e6..51c97ec91300 100644 --- a/python/helpers/generator3.py +++ b/python/helpers/generator3.py @@ -511,7 +511,7 @@ def process_one(name, mod_file_name, doing_builtins, sdk_skeletons_dir): sdk_skeletons_dir = sdk_skeletons_dir.rstrip(os.path.sep) try: python_stubs_dir = os.path.dirname(sdk_skeletons_dir) - global_cache_dir = os.path.join(python_stubs_dir, 'cache') + global_cache_dir = os.path.join(python_stubs_dir, CACHE_DIR_NAME) mod_cache_dir = build_cache_dir_path(global_cache_dir, name, mod_file_name) # At the moment this is actually enforced on Java-side if not should_update_skeleton(sdk_skeletons_dir, name, mod_file_name): diff --git a/python/helpers/pycharm_generator_utils/constants.py b/python/helpers/pycharm_generator_utils/constants.py index d5b4a619fe10..22cc76e31231 100644 --- a/python/helpers/pycharm_generator_utils/constants.py +++ b/python/helpers/pycharm_generator_utils/constants.py @@ -812,4 +812,7 @@ BLACKLIST_VERSION_LINE = re.compile(r'(?P[^=]+) = (?P\d+\.\d+) (? ENV_TEST_MODE_FLAG = 'GENERATOR3_TEST_MODE' ENV_VERSION = 'GENERATOR3_VERSION' ENV_REQUIRED_GEN_VERSION_FILE = 'GENERATOR3_REQUIRED_GEN_VERSION_FILE' + FAILED_VERSION_STAMP_PREFIX = '.failed__' + +CACHE_DIR_NAME = 'cache' diff --git a/python/helpers/pycharm_generator_utils/test/test_generation.py b/python/helpers/pycharm_generator_utils/test/test_generation.py index 38c4622ce54c..57228acc971a 100644 --- a/python/helpers/pycharm_generator_utils/test/test_generation.py +++ b/python/helpers/pycharm_generator_utils/test/test_generation.py @@ -11,6 +11,7 @@ from pycharm_generator_utils.constants import ( ENV_TEST_MODE_FLAG, ENV_VERSION, ENV_REQUIRED_GEN_VERSION_FILE, + CACHE_DIR_NAME, ) from pycharm_generator_utils.test import GeneratorTestCase @@ -95,7 +96,7 @@ class SkeletonCachingTest(GeneratorTestCase): @property def temp_cache_dir(self): - return os.path.join(self.temp_dir, self.PYTHON_STUBS_DIR, 'cache') + return os.path.join(self.temp_dir, self.PYTHON_STUBS_DIR, CACHE_DIR_NAME) @staticmethod def imported_module_path(mod_qname, extra_syspath_entry):