-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor versioning to be more easily extensible
- Loading branch information
Showing
6 changed files
with
216 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
import __future__ | ||
|
||
import collections | ||
import os.path | ||
import sys | ||
|
||
|
||
def main() -> int: | ||
assert sys.version_info >= (3, 10), 'need python3.10' | ||
|
||
by_version = collections.defaultdict(list) | ||
|
||
for k, v in vars(__future__).items(): | ||
if k == 'barry_as_FLUFL' or not hasattr(v, 'mandatory'): | ||
continue | ||
|
||
if v.mandatory[1] == 0: | ||
version = (v.mandatory[0],) | ||
else: | ||
version = v.mandatory[:2] | ||
|
||
by_version[version].append(k) | ||
|
||
print(f'# GENERATED VIA {os.path.basename(sys.argv[0])}') | ||
for v_k, v in sorted(by_version.items()): | ||
s = f'from __future__ import {", ".join(sorted(v))}' | ||
line = f'REMOVALS[{v_k}].add({s!r})' | ||
if len(line) >= 79: | ||
line = f'{line} # noqa: E501' | ||
print(line) | ||
print('# END GENERATED') | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python3 | ||
import builtins | ||
import os.path | ||
import sys | ||
|
||
import future.builtins | ||
|
||
|
||
def main() -> int: | ||
|
||
names = sorted( | ||
k for k, v in vars(future.builtins).items() | ||
if getattr(builtins, k, None) is v | ||
) | ||
print(f'# GENERATED VIA {os.path.basename(sys.argv[0])}') | ||
print(f'# Using future=={future.__version__}') | ||
print('REMOVALS[(3,)].update((') | ||
print(" 'from builtins import *',") | ||
for name in names: | ||
print(f" 'from builtins import {name}',") | ||
print('))') | ||
print('# END GENERATED') | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.