Skip to content

Commit

Permalink
Switch to a raw string for various regexes. (#174)
Browse files Browse the repository at this point in the history
Otherwise, when running against Python 3.12, we see warnings like
SyntaxWarning: invalid escape sequence '\d'

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored May 3, 2024
1 parent 5857d99 commit 0de4a5e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/rosdistro/distribution_cache_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def generate_distribution_cache(index, dist_name, preclean=False, ignore_local=F
errors.append('%s: invalid package.xml file for package "%s": %s' % (dist_name, pkg_name, e))
continue
# check that version numbers match (at least without deb inc)
if not re.match('^%s(-[\dA-z~\+\.]+)?$' % re.escape(pkg.version), repo.version):
if not re.match(r'^%s(-[\dA-z~\+\.]+)?$' % re.escape(pkg.version), repo.version):
errors.append('%s: different version in package.xml (%s) for package "%s" than for the repository (%s) (after removing the debian increment)' % (dist_name, pkg.version, pkg_name, repo.version))

if package_xml != old_package_xml:
Expand Down
4 changes: 2 additions & 2 deletions src/rosdistro/external/appdirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):


def site_data_dir(appname=None, appauthor=None, version=None, multipath=False):
"""Return full path to the user-shared data dir for this application.
r"""Return full path to the user-shared data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
Expand Down Expand Up @@ -200,7 +200,7 @@ def user_config_dir(appname=None, appauthor=None, version=None, roaming=False):


def site_config_dir(appname=None, appauthor=None, version=None, multipath=False):
"""Return full path to the user-shared data dir for this application.
r"""Return full path to the user-shared data dir for this application.
"appname" is the name of application.
If None, just the system directory is returned.
Expand Down
2 changes: 1 addition & 1 deletion src/rosdistro/release_cache_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def generate_release_cache(index, dist_name, preclean=False, debug=False):
errors.append('%s: invalid package.xml file for package "%s"' % (dist_name, pkg_name))
continue
# check that version numbers match (at least without deb inc)
if not re.match('^%s(-[\dA-z~\+\.]+)?$' % re.escape(pkg.version), repo.version):
if not re.match(r'^%s(-[\dA-z~\+\.]+)?$' % re.escape(pkg.version), repo.version):
errors.append('%s: different version in package.xml (%s) for package "%s" than for the repository (%s) (after removing the debian increment)' % (dist_name, pkg.version, pkg_name, repo.version))

if not debug:
Expand Down
2 changes: 1 addition & 1 deletion src/rosdistro/repository_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

class RepositorySpecification(object):
# Match groups are server and path on server.
VCS_REGEX = re.compile('(?:https?:\/\/|ssh:\/\/|git:\/\/|git@)((?:[a-fA-F0-9]{40}@)?[\w.-]+)[:/]([\w/-]*)(?:\.git)?$')
VCS_REGEX = re.compile(r'(?:https?:\/\/|ssh:\/\/|git:\/\/|git@)((?:[a-fA-F0-9]{40}@)?[\w.-]+)[:/]([\w/-]*)(?:\.git)?$')

def __init__(self, name, data):
self.name = name
Expand Down

0 comments on commit 0de4a5e

Please sign in to comment.