Repository: pypa/setuptools (python)

Issue:
Warning not filtered as supposed to
The warning emitted for missing standard script name in [py36compat.py](https://github.com/pypa/setuptools/blob/master/setuptools/command/py36compat.py#L76) is not suppressed by [`manifest_maker.warn`](https://github.com/pypa/setuptools/blob/master/setuptools/command/egg_info.py#L558) but seems to be supposed to.

I found this while exploring a setup.py as a directory containing a `__main__.py`.  I happened to run

```
python setup.py/__main__.py
```

and I had a warning about the file `__main__.py` missing.

You can suppress the warning by using the `script_name` keyword argument of `setuptools.setup` like so:

```
from setuptools import setup

setup(
    name="mypackage",
    # ... a plethora of other kwargs
    script_name="setup.py"
)
```


Pull request description:
Also suppress warning for a single file missing
Replaces #826
Fixes #825

In order to make a test without adding mocks or other monkeys patches, I extracted the check for suppression in a static method.

Patch:
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 6cc8f4c45..6f8fd8744 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -554,10 +554,17 @@ class manifest_maker(sdist):
         msg = "writing manifest file '%s'" % self.manifest
         self.execute(write_file, (self.manifest, files), msg)
 
-    def warn(self, msg):  # suppress missing-file warnings from sdist
-        if not msg.startswith("standard file not found:"):
+    def warn(self, msg):
+        if not self._should_suppress_warning(msg):
             sdist.warn(self, msg)
 
+    @staticmethod
+    def _should_suppress_warning(msg):
+        """
+        suppress missing-file warnings from sdist
+        """
+        return re.match(r"standard file .*not found", msg)
+
     def add_defaults(self):
         sdist.add_defaults(self)
         self.filelist.append(self.template)


Test patch:
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 12c104972..dc41bc1f2 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -4,7 +4,7 @@ import re
 import stat
 import sys
 
-from setuptools.command.egg_info import egg_info
+from setuptools.command.egg_info import egg_info, manifest_maker
 from setuptools.dist import Distribution
 from setuptools.extern.six.moves import map
 
@@ -237,6 +237,15 @@ class TestEggInfo(object):
         pkginfo = os.path.join(egg_info_dir, 'PKG-INFO')
         assert 'Requires-Python: >=1.2.3' in open(pkginfo).read().split('\n')
 
+    def test_manifest_maker_warning_suppresion(self):
+        fixtures = [
+            "standard file not found: should have one of foo.py, bar.py",
+            "standard file 'setup.py' not found"
+        ]
+
+        for msg in fixtures:
+            assert manifest_maker._should_suppress_warning(msg)
+
     def _run_install_command(self, tmpdir_cwd, env, cmd=None, output=None):
         environ = os.environ.copy().update(
             HOME=env.paths['home'],