mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Fix re-arranging the *.ino/pde files when converting to *.cpp // Resolve #100
This commit is contained in:
@ -4,8 +4,8 @@ Release History
|
||||
1.2.0 (2015-03-??)
|
||||
------------------
|
||||
|
||||
* Initial support of `mbed <http://docs.platformio.org/en/latest/frameworks/mbed.html>`__
|
||||
framework (only core SDK)
|
||||
* Added full support of `mbed <http://docs.platformio.org/en/latest/frameworks/mbed.html>`__
|
||||
framework including libraries: *RTOS, Ethernet, DSP, FAT, USB*.
|
||||
* Added `freescalekinetis <http://docs.platformio.org/en/latest/platforms/freescalekinetis.html>`_
|
||||
development platform with Freescale Kinetis Freedom boards
|
||||
* Added `nordicnrf51 <http://docs.platformio.org/en/latest/platforms/nordicnrf51.html>`_
|
||||
@ -26,8 +26,12 @@ Release History
|
||||
builder (`issue #105 <https://github.com/ivankravets/platformio/issues/105>`_)
|
||||
* Renamed ``stm32`` development platform to
|
||||
`ststm32 <http://docs.platformio.org/en/latest/platforms/ststm32.html>`__
|
||||
* Renamed ``opencm3`` framework to
|
||||
`libopencm3 <http://docs.platformio.org/en/latest/frameworks/libopencm3.html>`__
|
||||
* Fixed uploading for `atmelsam <http://docs.platformio.org/en/latest/platforms/atmelsam.html>`__
|
||||
development platform
|
||||
* Fixed re-arranging the ``*.ino/pde`` files when converting to ``*.cpp``
|
||||
(`issue #100 <https://github.com/ivankravets/platformio/issues/100>`_)
|
||||
|
||||
1.1.0 (2015-03-05)
|
||||
------------------
|
||||
|
@ -176,7 +176,11 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
|
||||
|
||||
for ld in listdir(lsd_dir):
|
||||
inc_path = normpath(join(lsd_dir, ld, self.name))
|
||||
lib_dir = inc_path[:inc_path.index(sep, len(lsd_dir) + 1)]
|
||||
try:
|
||||
lib_dir = inc_path[:inc_path.index(
|
||||
sep, len(lsd_dir) + 1)]
|
||||
except ValueError:
|
||||
continue
|
||||
lib_name = basename(lib_dir)
|
||||
|
||||
# ignore user's specified libs
|
||||
@ -284,9 +288,6 @@ def ConvertInoToCpp(env):
|
||||
continue
|
||||
ino_contents = item.get_text_contents()
|
||||
|
||||
re_includes = re.compile(r"^(#include\s+(?:\<|\")[^\r\n]+)",
|
||||
re.M | re.I)
|
||||
includes = re_includes.findall(ino_contents)
|
||||
prototypes = re.findall(
|
||||
r"""^(
|
||||
(?:\s*[a-z_\d]+){1,2} # return type
|
||||
@ -297,19 +298,15 @@ def ConvertInoToCpp(env):
|
||||
ino_contents,
|
||||
re.X | re.M | re.I
|
||||
)
|
||||
# print includes, prototypes
|
||||
|
||||
# disable previous includes
|
||||
ino_contents = re_includes.sub(r"//\1", ino_contents)
|
||||
prototypes = [p.strip() for p in prototypes]
|
||||
# print prototypes
|
||||
|
||||
# create new temporary C++ valid file
|
||||
with open(cppfile, "w") as f:
|
||||
f.write("#include <Arduino.h>\n")
|
||||
if includes:
|
||||
f.write("%s\n" % "\n".join(includes))
|
||||
if prototypes:
|
||||
f.write("%s;\n" % ";\n".join(prototypes))
|
||||
f.write("#line 1 \"%s\"\n" % basename(item.path))
|
||||
f.write('#line 1 "%s"\n' % basename(item.path))
|
||||
f.write(ino_contents)
|
||||
tmpcpp.append(cppfile)
|
||||
|
||||
|
Reference in New Issue
Block a user