Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 31a858c

Browse files
Issue #16620: Got rid of using undocumented function glob.glob1().
1 parent 47670eb commit 31a858c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Lib/msilib/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (C) 2005 Martin v. Löwis
22
# Licensed to PSF under a Contributor Agreement.
33
from _msi import *
4-
import glob
4+
import fnmatch
55
import os
66
import re
77
import string
@@ -379,7 +379,13 @@ def add_file(self, file, src=None, version=None, language=None):
379379
def glob(self, pattern, exclude = None):
380380
"""Add a list of files to the current component as specified in the
381381
glob pattern. Individual files can be excluded in the exclude list."""
382-
files = glob.glob1(self.absolute, pattern)
382+
try:
383+
files = os.listdir(self.absolute)
384+
except OSError:
385+
return []
386+
if pattern[:1] != '.':
387+
files = (f for f in files if f[0] != '.')
388+
files = fnmatch.filter(files, pattern)
383389
for f in files:
384390
if exclude and f in exclude: continue
385391
self.add_file(f)

0 commit comments

Comments
 (0)