mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Remove ProjectConfig cache when "platformio.ini" was modified outside
This commit is contained in:
@ -6,6 +6,11 @@ Release Notes
|
||||
PlatformIO 4.0
|
||||
--------------
|
||||
|
||||
4.0.3 (2019-??-??)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Remove ProjectConfig cache when "platformio.ini" was modified outside
|
||||
|
||||
4.0.2 (2019-08-23)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
VERSION = (4, 0, 2)
|
||||
VERSION = (4, 0, "3a1")
|
||||
__version__ = ".".join([str(s) for s in VERSION])
|
||||
|
||||
__title__ = "platformio"
|
||||
|
@ -388,7 +388,6 @@ def fill_project_envs(ctx, project_dir, board_ids, project_option, env_prefix,
|
||||
|
||||
if modified:
|
||||
config.save()
|
||||
config.reset_instances()
|
||||
|
||||
|
||||
def _install_dependent_platforms(ctx, platforms):
|
||||
|
@ -16,7 +16,7 @@ import glob
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from os.path import expanduser, isfile
|
||||
from os.path import expanduser, getmtime, isfile
|
||||
|
||||
import click
|
||||
|
||||
@ -72,13 +72,14 @@ class ProjectConfig(object):
|
||||
|
||||
@staticmethod
|
||||
def get_instance(path):
|
||||
if path not in ProjectConfig._instances:
|
||||
ProjectConfig._instances[path] = ProjectConfig(path)
|
||||
return ProjectConfig._instances[path]
|
||||
|
||||
@staticmethod
|
||||
def reset_instances():
|
||||
ProjectConfig._instances = {}
|
||||
mtime = getmtime(path) if isfile(path) else 0
|
||||
instance = ProjectConfig._instances.get(path)
|
||||
if instance and instance["mtime"] != mtime:
|
||||
instance = None
|
||||
if not instance:
|
||||
instance = {"mtime": mtime, "config": ProjectConfig(path)}
|
||||
ProjectConfig._instances[path] = instance
|
||||
return instance["config"]
|
||||
|
||||
def __init__(self, path, parse_extra=True, expand_interpolations=True):
|
||||
self.path = path
|
||||
|
Reference in New Issue
Block a user