checkout: Use new / operator for Paths

Change-Id: Ie8570f7cf8216fc2dc3f27568fe0d66cdd48c760
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/138230
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: Oliver Newman <olivernewman@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/recipe_modules/checkout/api.py b/recipe_modules/checkout/api.py
index f1ebf8c..28d4641 100644
--- a/recipe_modules/checkout/api.py
+++ b/recipe_modules/checkout/api.py
@@ -244,14 +244,14 @@
         if self.manifest_snapshot():
             self._api.file.write_text(
                 'write manifest.xml',
-                directory.join('manifest.xml'),
+                directory / 'manifest.xml',
                 self.manifest_snapshot(),
             )
 
         if self.submodule_snapshot():
             self._api.file.write_text(
                 'write submodule snapshot',
-                directory.join('submodules.log'),
+                directory / 'submodules.log',
                 self.submodule_snapshot(),
             )
 
@@ -266,7 +266,7 @@
                 ok_ret='any',
             ).stdout
         self._api.file.write_text(
-            'write git log', directory.join('git.log'), log,
+            'write git log', directory / 'git.log', log,
         )
 
     def submodules(self, recursive=False):
@@ -293,7 +293,7 @@
             if sub['remote'].endswith('.git'):
                 sub['remote'] = sub['remote'][:-4]
             sub['relative_path'] = sub['path']
-            sub['path'] = self.root.join(sub['path'])
+            sub['path'] = self.root / sub['path']
             submodules.append(Submodule(self._api, **sub))
 
         return submodules
@@ -412,7 +412,7 @@
 
             self.m.file.write_json(
                 'manifest json',
-                self.m.path['start_dir'].join('manifest.json'),
+                self.m.path['start_dir'] / 'manifest.json',
                 manifest.dict(),
             )
 
@@ -822,11 +822,11 @@
                 ).replace(
                     '/', '-'
                 )
-                cache_path = self.m.path['cache'].join('git', cache_name)
+                cache_path = self.m.path['cache'] / 'git' / cache_name
                 self.m.file.ensure_directory('makedirs', cache_path)
 
                 with self.m.context(cwd=cache_path):
-                    dotgit = cache_path.join('.git')
+                    dotgit = cache_path / '.git'
                     if self.m.path.exists(dotgit):  # pragma: no cover
                         self.m.git.config_remove_section(
                             'remote.origin', **kwargs
@@ -1182,7 +1182,7 @@
                     **kwargs,
                 )
 
-            manifests_dir = ctx.root.join('.repo', 'manifests')
+            manifests_dir = ctx.root / '.repo' / 'manifests'
             # If the triggering CL is a manifest change, apply it before running
             # sync.
             if ctx.options.use_trigger:
@@ -1210,8 +1210,7 @@
                         )
 
             ctx.manifest = self._read_manifest(
-                ctx.options.remote,
-                manifests_dir.join(ctx.options.manifest_file),
+                ctx.options.remote, manifests_dir / ctx.options.manifest_file,
             )
 
             for _, remote_host in sorted(ctx.manifest.remotes.items()):
@@ -1256,7 +1255,7 @@
         # point to the actual repo workspace root.
         ctx.top = ctx.root
         files = set(self.m.file.listdir('ls', ctx.root))
-        dotrepo = ctx.root.join('.repo')
+        dotrepo = ctx.root / '.repo'
         if dotrepo in files:
             files.remove(dotrepo)
         orig_root = ctx.root
@@ -1289,7 +1288,7 @@
         ctx = CheckoutContext(api=self.m)
         ctx.options = options
         ctx.changes = []
-        ctx.root = root or self.m.path['start_dir'].join('co')
+        ctx.root = root or self.m.path['start_dir'] / 'co'
 
         for remotes in options.equivalent_remotes:
             new_remotes = [self.m.sso.sso_to_https(x) for x in remotes.remotes]
@@ -1321,12 +1320,12 @@
                         f'failed to apply {change.name}'
                     ] = change.gerrit_url
 
-            snapshot_dir = self.m.path['start_dir'].join('snapshot')
+            snapshot_dir = self.m.path['start_dir'] / 'snapshot'
             ctx.snapshot_to_dir(snapshot_dir)
 
             ctx.top = ctx.root
             if ctx.options.root_subdirectory:
-                ctx.root = ctx.root.join(ctx.options.root_subdirectory)
+                ctx.root = ctx.root / ctx.options.root_subdirectory
 
         return ctx
 
diff --git a/recipe_modules/checkout/tests/repo.py b/recipe_modules/checkout/tests/repo.py
index 2c5c792..d3eb904 100644
--- a/recipe_modules/checkout/tests/repo.py
+++ b/recipe_modules/checkout/tests/repo.py
@@ -37,7 +37,7 @@
             with api.step.nest(str(i)) as pres:
                 pres.step_summary_text = repr(change)
     with api.step.nest('snapshot_to_dir'):
-        checkout.snapshot_to_dir(api.path['start_dir'].join('snapshot'))
+        checkout.snapshot_to_dir(api.path['start_dir'] / 'snapshot')
 
 
 def GenTests(api):  # pylint: disable=invalid-name
diff --git a/recipe_modules/checkout/tests/submodule.py b/recipe_modules/checkout/tests/submodule.py
index 07ce685..ac6bec6 100644
--- a/recipe_modules/checkout/tests/submodule.py
+++ b/recipe_modules/checkout/tests/submodule.py
@@ -30,7 +30,7 @@
     checkout = api.checkout(props.checkout_options)
 
     with api.step.nest('snapshot_to_dir'):
-        checkout.snapshot_to_dir(api.path['start_dir'].join('snapshot'))
+        checkout.snapshot_to_dir(api.path['start_dir'] / 'snapshot')
 
 
 def GenTests(api):  # pylint: disable=invalid-name