forked from platformio/platformio-core
Fix an issue with incorrect detecting of compatibility (LDF) between generic library and Arduino or ARM mbed frameworks
This commit is contained in:
@ -13,6 +13,8 @@ PlatformIO 3.0
|
||||
(`issue #1674 <https://github.com/platformio/platformio-core/issues/1674>`_)
|
||||
- CLion: Improved project portability using "${CMAKE_CURRENT_LIST_DIR}" instead of full path
|
||||
|
||||
* Fixed an issue with incorrect detecting of compatibility (LDF) between generic library and Arduino or ARM mbed frameworks
|
||||
|
||||
3.6.3 (2018-12-12)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -19,6 +19,7 @@ from __future__ import absolute_import
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from glob import glob
|
||||
from os.path import (basename, commonprefix, dirname, isdir, isfile, join,
|
||||
@ -64,6 +65,9 @@ class LibBuilderFactory(object):
|
||||
if isfile(join(path, "module.json")):
|
||||
return ["mbed"]
|
||||
|
||||
include_re = re.compile(
|
||||
r'^#include\s+(<|")(Arduino|mbed)\.h(<|")', flags=re.MULTILINE)
|
||||
|
||||
# check source files
|
||||
for root, _, files in os.walk(path, followlinks=True):
|
||||
for fname in files:
|
||||
@ -72,9 +76,9 @@ class LibBuilderFactory(object):
|
||||
continue
|
||||
with open(join(root, fname)) as f:
|
||||
content = f.read()
|
||||
if "Arduino.h" in content:
|
||||
if "Arduino.h" in content and include_re.search(content):
|
||||
return ["arduino"]
|
||||
elif "mbed.h" in content:
|
||||
elif "mbed.h" in content and include_re.search(content):
|
||||
return ["mbed"]
|
||||
return []
|
||||
|
||||
|
Reference in New Issue
Block a user