Commits

Donald Stufft committed 13147de

Disallow Non windows binary wheels

Comments (0)

Files changed (1)

 safe_email = re.compile(r'^[a-zA-Z0-9._+@-]+$')
 botre = re.compile(r'^$|brains|yeti|myie2|findlinks|ia_archiver|psycheclone|badass|crawler|slurp|spider|bot|scooter|infoseek|looksmart|jeeves', re.I)
 
+wheel_file_re = re.compile(
+                r"""^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
+                ((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
+                \.whl|\.dist-info)$""",
+                re.VERBOSE)
+
 packages_path_to_package_name = re.compile(
     '^/([0-9\.]+|any|source)/./([a-zA-Z0-9][a-zA-Z0-9_\-\.]*)')
 
         if not verify_filetype.is_distutils_file(content, filename, filetype):
             raise FormError, 'invalid distribution file'
 
+        # Check that if it's a binary wheel, it's on a supported platform
+        #   TODO(dstufft): Remove this once we have a better binary distribution
+        #       story for Linux and such
+        if filename.endswith(".whl"):
+            wheel_info = wheel_file_re.match(filename)
+            plats = wheel_info.group('plat').split('.')
+            if set(plats) - set(["any", "win32", "win-amd64", "win-ia64"]):
+                raise FormError, "Binary wheel for an unsupported platform"
+
         # Check whether signature is ASCII-armored
         if signature and not signature.startswith("-----BEGIN PGP SIGNATURE-----"):
             raise FormError, "signature is not ASCII-armored"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.