Skip to content

Commit

Permalink
Clean bazel stuff on distutils clean. (#5274)
Browse files Browse the repository at this point in the history
* Clean bazel stuff on distutils clean

* Fix python formatting
  • Loading branch information
stgpetrovic authored and JackCaoG committed Jul 10, 2023
1 parent cba267f commit a2d99ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ def maybe_bundle_libtpu(base_dir):

class Clean(distutils.command.clean.clean):

def bazel_clean_(self):
self.spawn(['bazel', 'clean', '--expunge'])

def run(self):
import glob
import re
Expand All @@ -183,6 +186,8 @@ def run(self):
except OSError:
shutil.rmtree(filename, ignore_errors=True)

self.execute(self.bazel_clean_, (), msg="Cleaning bazel outputs")

# It's an old-style class in Python 2.7...
distutils.command.clean.clean.run(self)

Expand Down

0 comments on commit a2d99ac

Please sign in to comment.