src/eric7/Graphics/ApplicationDiagramBuilder.py

branch
eric7
changeset 9645
31aaa11672d3
parent 9624
b47dfa7a137d
child 9646
ab5678db972f
equal deleted inserted replaced
9644:9875d5f11cbf 9645:31aaa11672d3
115 init = os.path.join(path, "__init__.py") 115 init = os.path.join(path, "__init__.py")
116 if os.path.exists(init): 116 if os.path.exists(init):
117 # project is a package 117 # project is a package
118 return path 118 return path
119 else: 119 else:
120 # TODO: replace os.listdir() with os.scandir()
120 # check, if any of the top directories is a package 121 # check, if any of the top directories is a package
121 for entry in [e for e in os.listdir(path) if not e.startswith(".")]: 122 for entry in [e for e in os.listdir(path) if not e.startswith(".")]:
122 fullpath = os.path.join(path, entry) 123 fullpath = os.path.join(path, entry)
123 if os.path.isdir(fullpath): 124 if os.path.isdir(fullpath):
124 init = os.path.join(fullpath, "__init__.py") 125 init = os.path.join(fullpath, "__init__.py")
125 if os.path.exists(init): 126 if os.path.exists(init):
126 candidates.append(fullpath) 127 candidates.append(fullpath)
127 128
129 # TODO: replace os.listdir() with os.scandir()
128 # check, if project uses the 'src' layout 130 # check, if project uses the 'src' layout
129 if os.path.exists(os.path.join(path, "src")): 131 if os.path.exists(os.path.join(path, "src")):
130 srcPath = os.path.join(path, "src") 132 srcPath = os.path.join(path, "src")
131 for entry in [e for e in os.listdir(srcPath) if not e.startswith(".")]: 133 for entry in [e for e in os.listdir(srcPath) if not e.startswith(".")]:
132 fullpath = os.path.join(srcPath, entry) 134 fullpath = os.path.join(srcPath, entry)

eric ide

mercurial