summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Kumar Banerjee <vijay@rtems.org>2021-04-02 19:17:17 -0600
committerVijay Kumar Banerjee <vijay@rtems.org>2021-04-13 23:56:19 -0600
commit6923bb47129e359fd63a459802e7fbfb35156e7f (patch)
tree7d1022fe9c063e2bf942880341e434f3046ae3b1
parentdd4c87392dc9e940a294d149c8be386c8f18b0f8 (diff)
downloadrtems-net-legacy-6923bb47129e359fd63a459802e7fbfb35156e7f.tar.bz2
netlegacy: Use os.path to get the file extension
-rw-r--r--bsp_drivers.py5
-rw-r--r--netlegacy.py5
2 files changed, 6 insertions, 4 deletions
diff --git a/bsp_drivers.py b/bsp_drivers.py
index cb6caa5..3ca10c6 100644
--- a/bsp_drivers.py
+++ b/bsp_drivers.py
@@ -62,9 +62,10 @@ def bsp_files(bld):
source_dir = os.walk(special_case_dirs[bsp])
for root, dirs, files in source_dir:
for name in files:
- if name[-2:] == '.c':
+ ext = os.path.splitext(name)[1]
+ if ext == '.c':
source_files[bsp].append(os.path.join(root, name))
- if name[-2:] == '.h':
+ if ext == '.h':
if root not in include_dirs[bsp]:
include_dirs[bsp].append(root)
if bsp in special_case_sources:
diff --git a/netlegacy.py b/netlegacy.py
index 0889548..89176e6 100644
--- a/netlegacy.py
+++ b/netlegacy.py
@@ -40,9 +40,10 @@ for root, dirs, files in os.walk("."):
dirs.append('./bsps/shared/net')
include_files[root[2:]] = []
for name in files:
- if name[-2:] == '.c':
+ ext = os.path.splitext(name)[1]
+ if ext == '.c':
source_files.append(os.path.join(root, name))
- if name[-2:] == '.h' and name not in exclude_headers:
+ if ext == '.h' and name not in exclude_headers:
include_files[root[2:]].append(os.path.join(root, name))