Skip to content

Commit

Permalink
Fix invalid regex and escape sequences causing DeprecationWarning (#646)
Browse files Browse the repository at this point in the history
These bad escape sequences were causing `DeprecationWarning`s when running Pants with Python 3.

Invalid entries were found through the regex `'re\..*\\'`, and equality to original string tested by comparing the two in a REPL.
  • Loading branch information
Eric-Arellano authored Jan 21, 2019
1 parent 812a34f commit 16cfd97
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pex/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class WheelMetadata(pkg_resources.EggMetadata):
@classmethod
def _escape(cls, filename_component):
# See: https://www.python.org/dev/peps/pep-0427/#escaping-and-unicode
return re.sub("[^\w\d.]+", "_", filename_component, re.UNICODE)
return re.sub(r"[^\w\d.]+", "_", filename_component, re.UNICODE)

@classmethod
def _split_wheelname(cls, wheelname):
Expand Down
2 changes: 1 addition & 1 deletion pex/vendor/_vendored/wheel/wheel/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# Wheel itself is probably the only program that uses non-extras markers
# in METADATA/PKG-INFO. Support its syntax with the extra at the end only.
EXTRA_RE = re.compile("""^(?P<package>.*?)(;\s*(?P<condition>.*?)(extra == '(?P<extra>.*?)')?)$""")
EXTRA_RE = re.compile(r"^(?P<package>.*?)(;\s*(?P<condition>.*?)(extra == '(?P<extra>.*?)')?)$")

MayRequiresKey = namedtuple('MayRequiresKey', ('condition', 'extra'))

Expand Down

0 comments on commit 16cfd97

Please sign in to comment.