Mercurial > cpython-lru_cache-weakref
comparison Tools/scripts/patchcheck.py @ 66382:ada67de64919
Fix resource warning from patchcheck.py
| author | Éric Araujo <merwok@netwok.org> |
|---|---|
| date | Mon, 22 Nov 2010 03:13:47 +0000 |
| parents | 2e19d1f4b612 |
| children | 3c9232a684ae |
comparison
equal
deleted
inserted
replaced
| 66381:0813c2acf741 | 66382:ada67de64919 |
|---|---|
| 43 cmd = 'svn status --quiet --non-interactive --ignore-externals' | 43 cmd = 'svn status --quiet --non-interactive --ignore-externals' |
| 44 else: | 44 else: |
| 45 sys.exit('need a checkout to get modified files') | 45 sys.exit('need a checkout to get modified files') |
| 46 | 46 |
| 47 st = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) | 47 st = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) |
| 48 st.wait() | 48 try: |
| 49 if vcs == 'hg': | 49 st.wait() |
| 50 return [x.decode().rstrip() for x in st.stdout] | 50 if vcs == 'hg': |
| 51 else: | 51 return [x.decode().rstrip() for x in st.stdout] |
| 52 output = (x.decode().rstrip().rsplit(None, 1)[-1] | 52 else: |
| 53 for x in st.stdout if x[0] in b'AM') | 53 output = (x.decode().rstrip().rsplit(None, 1)[-1] |
| 54 for x in st.stdout if x[0] in b'AM') | |
| 54 return set(path for path in output if os.path.isfile(path)) | 55 return set(path for path in output if os.path.isfile(path)) |
| 56 finally: | |
| 57 st.stdout.close() | |
| 55 | 58 |
| 56 | 59 |
| 57 def report_modified_files(file_paths): | 60 def report_modified_files(file_paths): |
| 58 count = len(file_paths) | 61 count = len(file_paths) |
| 59 if count == 0: | 62 if count == 0: |
