Skip to content

Commit 5594dac

Browse files
committed
make.py: now checking package list for duplicates and unsupported packages
1 parent b06c553 commit 5594dac

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

make.py

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,32 @@ def _add_msvc_files(self):
382382
python_version=self.distribution.version):
383383
shutil.copy(fname, self.python_dir)
384384

385+
def _check_packages(self):
386+
"""Check packages for duplicates or unsupported packages"""
387+
print("Checking packages")
388+
packages = []
389+
for fname0 in os.listdir(self.srcdir) + os.listdir(self.instdir):
390+
fname = self.get_package_fname(fname0)
391+
if fname == self.python_fname:
392+
continue
393+
try:
394+
pack = wppm.Package(fname)
395+
except NotImplementedError:
396+
print("WARNING: package %s is not supported"\
397+
% osp.basename(fname), file=sys.stderr)
398+
continue
399+
packages.append(pack)
400+
all_duplicates = []
401+
for pack in packages:
402+
if pack.name in all_duplicates:
403+
continue
404+
all_duplicates.append(pack.name)
405+
duplicates = [p for p in packages if p.name == pack.name]
406+
if len(duplicates) > 1:
407+
print("WARNING: duplicate packages %s (%s)" % \
408+
(pack.name, ", ".join([p.version for p in duplicates])),
409+
file=sys.stderr)
410+
385411
def _install_required_packages(self):
386412
"""Installing required packages"""
387413
print("Installing required packages")
@@ -403,10 +429,12 @@ def _install_all_other_packages(self):
403429
"""Try to install all other packages in instdir"""
404430
print("Installing other packages")
405431
for fname in os.listdir(self.srcdir) + os.listdir(self.instdir):
406-
try:
407-
self.install_package(fname)
408-
except NotImplementedError:
409-
pass
432+
if osp.basename(fname) != osp.basename(self.python_fname):
433+
try:
434+
self.install_package(fname)
435+
except NotImplementedError:
436+
print("WARNING: unable to install package %s"\
437+
% osp.basename(fname), file=sys.stderr)
410438

411439
def _copy_dev_tools(self):
412440
"""Copy dev tools"""
@@ -564,6 +592,8 @@ def make(self, remove_existing=True):
564592
self.distribution = wppm.Distribution(self.python_dir,
565593
verbose=self.verbose, indent=True)
566594

595+
self._check_packages()
596+
567597
if remove_existing:
568598
if not self.simulation:
569599
self._add_msvc_files()
@@ -677,5 +707,5 @@ def make_all(build_number, release_level, pyver,
677707

678708

679709
if __name__ == '__main__':
680-
make_all(1, '', pyver='2.7')
681-
make_all(1, '', pyver='3.3')
710+
make_all(1, '', pyver='2.7', simulation=True)
711+
make_all(1, '', pyver='3.3', simulation=True)

0 commit comments

Comments
 (0)