[Git][ghc/ghc][wip/test] 3 commits: docs/compare-flags: Don't use python f-strings
Ben Gamari
gitlab at gitlab.haskell.org
Wed Mar 18 19:35:49 UTC 2020
Ben Gamari pushed to branch wip/test at Glasgow Haskell Compiler / GHC
Commits:
544e24e1 by Ben Gamari at 2020-03-18T19:35:34Z
docs/compare-flags: Don't use python f-strings
- - - - -
24966161 by Ben Gamari at 2020-03-18T19:35:38Z
compare-flags: Don't rely on encoding flag of subprocess.check_output
Apparently it isn't supported by some slightly older Python versions.
- - - - -
0fd7e009 by Ben Gamari at 2020-03-18T19:35:42Z
compare-flags: Fix output
- - - - -
1 changed file:
- docs/users_guide/compare-flags.py
Changes:
=====================================
docs/users_guide/compare-flags.py
=====================================
@@ -48,13 +48,15 @@ def read_documented_flags(doc_flags) -> Set[str]:
if line != ''}
def read_ghc_flags(ghc_path: str) -> Set[str]:
- ghc_output = subprocess.check_output([ghc_path, '--show-options'],
- encoding='UTF-8')
+ ghc_output = subprocess.check_output([ghc_path, '--show-options'])
return {flag
- for flag in ghc_output.split('\n')
+ for flag in ghc_output.decode('UTF-8').split('\n')
if not expected_undocumented(flag)
if flag != ''}
+def error(s: str):
+ print(s, file=sys.stderr)
+
def main() -> None:
import argparse
parser = argparse.ArgumentParser()
@@ -71,16 +73,16 @@ def main() -> None:
undocumented = ghc_flags - doc_flags
if len(undocumented) > 0:
- print(f'Found {len(undocumented)} flags not documented in the users guide:')
- print('\n'.join(f' {flag}' for flag in sorted(undocumented)))
- print()
+ error('Found {len_undoc} flags not documented in the users guide:'.format(len_undoc=len(undocumented)), )
+ error('\n'.join(' {}'.format(flag) for flag in sorted(undocumented)))
+ error('')
failed = True
now_documented = EXPECTED_UNDOCUMENTED.intersection(doc_flags)
if len(now_documented) > 0:
- print(f'Found flags that are documented yet listed in {EXPECTED_UNDOCUMENTED_PATH}:')
- print('\n'.join(f' {flag}' for flag in sorted(now_documented)))
- print()
+ error('Found flags that are documented yet listed in {}:'.format(EXPECTED_UNDOCUMENTED_PATH))
+ error('\n'.join(' {}'.format(flag) for flag in sorted(now_documented)))
+ error('')
failed = True
if failed:
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/5295fd5adc967f02ec8b0fa2f45e978e1f531295...0fd7e009024f76a4a245dc7c76e6cec28136e742
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/5295fd5adc967f02ec8b0fa2f45e978e1f531295...0fd7e009024f76a4a245dc7c76e6cec28136e742
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200318/3354b8dd/attachment-0001.html>
More information about the ghc-commits
mailing list