Implement changes to support PEP 552
This commit is contained in:
parent
7dcf1fa63d
commit
a2c8f50b30
@ -23,6 +23,7 @@ import sys
|
|||||||
PY3 = sys.version_info[0] >= 3
|
PY3 = sys.version_info[0] >= 3
|
||||||
PY35 = sys.version_info >= (3, 5)
|
PY35 = sys.version_info >= (3, 5)
|
||||||
PY36 = sys.version_info >= (3, 6)
|
PY36 = sys.version_info >= (3, 6)
|
||||||
|
PY37 = sys.version_info >= (3, 7)
|
||||||
|
|
||||||
str_type = str if PY3 else unicode # NOQA
|
str_type = str if PY3 else unicode # NOQA
|
||||||
bytes_type = bytes if PY3 else str # NOQA
|
bytes_type = bytes if PY3 else str # NOQA
|
||||||
|
@ -18,7 +18,7 @@ import inspect
|
|||||||
import os
|
import os
|
||||||
import __future__
|
import __future__
|
||||||
|
|
||||||
from hy._compat import PY3, MAGIC, builtins, long_type, wr_long
|
from hy._compat import PY3, PY37, MAGIC, builtins, long_type, wr_long
|
||||||
from hy._compat import string_types
|
from hy._compat import string_types
|
||||||
|
|
||||||
|
|
||||||
@ -220,6 +220,12 @@ def write_code_as_pyc(fname, code):
|
|||||||
|
|
||||||
with builtins.open(cfile, 'wb') as fc:
|
with builtins.open(cfile, 'wb') as fc:
|
||||||
fc.write(MAGIC)
|
fc.write(MAGIC)
|
||||||
|
if PY37:
|
||||||
|
# With PEP 552, the header structure has a new flags field
|
||||||
|
# that we need to fill in. All zeros preserve the legacy
|
||||||
|
# behaviour, but should we implement reproducible builds,
|
||||||
|
# this is where we'd add the information.
|
||||||
|
wr_long(fc, 0)
|
||||||
wr_long(fc, timestamp)
|
wr_long(fc, timestamp)
|
||||||
if PY3:
|
if PY3:
|
||||||
wr_long(fc, st.st_size)
|
wr_long(fc, st.st_size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user