Bug 1874684 - Part 28: Return DateDuration from DifferenceISODateTime. r=mgaudet
[gecko.git] / python / mozbuild / mozbuild / pythonutil.py
bloba3540647f94da079d96aad19f28ba395f61e8107
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 import os
6 import sys
9 def iter_modules_in_path(*paths):
10 paths = [os.path.abspath(os.path.normcase(p)) + os.sep for p in paths]
11 for name, module in sys.modules.items():
12 if getattr(module, "__file__", None) is None:
13 continue
14 if module.__file__ is None:
15 continue
16 path = module.__file__
18 if path.endswith(".pyc"):
19 path = path[:-1]
20 path = os.path.abspath(os.path.normcase(path))
22 if any(path.startswith(p) for p in paths):
23 yield path