diff options
author | Johan Dahlin <zilch@src.gnome.org> | 2003-01-19 17:41:57 +0000 |
---|---|---|
committer | Johan Dahlin <zilch@src.gnome.org> | 2003-01-19 17:41:57 +0000 |
commit | 66707b642692514a002393db9b547690041d0c44 (patch) | |
tree | 3b5057e008e94c7613b857fa2fb3a949534f9be3 | |
parent | e4fe93cd953c57976ed28363df2fdf1526881e5d (diff) | |
download | pygobject-66707b642692514a002393db9b547690041d0c44.tar.gz |
Check if a directory is empty before adding it to the path. Also added a
* pygtk.py (_get_available_versions): Check if a directory is
empty before adding it to the path. Also added a few comments.
Fixes #103876 (Ross Burton).
-rw-r--r-- | pygtk.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -35,16 +35,24 @@ def _get_available_versions(): for dir in sys.path: if not dir: dir = os.getcwd() + if not os.path.isdir(dir): continue + # if the dir is a pygtk dir, skip it if fnmatch.fnmatchcase(os.path.basename(dir), _pygtk_dir_pat): - continue # if the dir is a pygtk dir, skip it + continue for filename in glob.glob(os.path.join(dir, _pygtk_dir_pat)): pathname = os.path.join(dir, filename) + + # skip non directories if not os.path.isdir(pathname): - continue # skip non directories + continue + + # skip empty directories + if not os.listdir(pathname): + continue if not versions.has_key(filename[-3:]): versions[filename[-3:]] = pathname |