From f19e5732da07d22ea0d7c7a64ba7e736ba2d1a52 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 19 Oct 2016 14:02:08 -0400 Subject: Use rpartition for simplicity --- setuptools/dist.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setuptools/dist.py b/setuptools/dist.py index 367c26ea..a3099fcd 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -112,9 +112,8 @@ def check_nsp(dist, attr, value): "Distribution contains no modules or packages for " + "namespace package %r" % nsp ) - if '.' in nsp: - parent = '.'.join(nsp.split('.')[:-1]) - if parent not in value: + parent, sep, child = nsp.rpartition('.') + if parent and parent not in value: distutils.log.warn( "WARNING: %r is declared as a package namespace, but %r" " is not: please correct this in setup.py", nsp, parent -- cgit v1.2.1