Fixed an issue when Project Config Parser does not remove in-line comments when Python 3 is used // Remove #3213

This commit is contained in:
Ivan Kravets
2019-10-31 22:04:57 +02:00
parent 2c2b419685
commit 1d5d09feab
3 changed files with 9 additions and 4 deletions

View File

@ -38,6 +38,7 @@ PlatformIO Core 4.0
* Fixed an issue with project generator when ``src_build_flags`` were not respected (`issue #3137 <https://github.com/platformio/platformio-core/issues/3137>`_) * Fixed an issue with project generator when ``src_build_flags`` were not respected (`issue #3137 <https://github.com/platformio/platformio-core/issues/3137>`_)
* Fixed an issue when booleans in "platformio.ini" are not parsed properly (`issue #3022 <https://github.com/platformio/platformio-core/issues/3022>`_) * Fixed an issue when booleans in "platformio.ini" are not parsed properly (`issue #3022 <https://github.com/platformio/platformio-core/issues/3022>`_)
* Fixed an issue with invalid encoding when generating project for Visual Studio (`issue #3183 <https://github.com/platformio/platformio-core/issues/3183>`_) * Fixed an issue with invalid encoding when generating project for Visual Studio (`issue #3183 <https://github.com/platformio/platformio-core/issues/3183>`_)
* Fixed an issue when Project Config Parser does not remove in-line comments when Python 3 is used (`issue #3213 <https://github.com/platformio/platformio-core/issues/3213>`_)
4.0.3 (2019-08-30) 4.0.3 (2019-08-30)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -21,7 +21,7 @@ from hashlib import sha1
import click import click
from platformio import exception, fs from platformio import exception, fs
from platformio.compat import WINDOWS, hashlib_encode_data from platformio.compat import PY2, WINDOWS, hashlib_encode_data
from platformio.project.options import ProjectOptions from platformio.project.options import ProjectOptions
try: try:
@ -84,7 +84,11 @@ class ProjectConfigBase(object):
self.expand_interpolations = expand_interpolations self.expand_interpolations = expand_interpolations
self.warnings = [] self.warnings = []
self._parsed = [] self._parsed = []
self._parser = ConfigParser.ConfigParser() self._parser = (
ConfigParser.ConfigParser()
if PY2
else ConfigParser.ConfigParser(inline_comment_prefixes=("#", ";"))
)
if path and os.path.isfile(path): if path and os.path.isfile(path):
self.read(path, parse_extra) self.read(path, parse_extra)

View File

@ -28,9 +28,9 @@ extra_configs =
# global options per [env:*] # global options per [env:*]
[env] [env]
monitor_speed = 115200 monitor_speed = 115200 ; inline comment
lib_deps = lib_deps =
Lib1 Lib1 ; inline comment in multi-line value
Lib2 Lib2
lib_ignore = ${custom.lib_ignore} lib_ignore = ${custom.lib_ignore}