mirror of
https://github.com/facebook/sapling.git
synced 2024-12-26 14:34:34 +03:00
use python 3 for the eden_scm getdeps build
Summary: EdenFS is adding a Python 3 Thrift client intended for use by other projects, and the Mercurial Python 2 build doesn't understand Python 3 syntax files, so switch the default getdeps build to Python 3. Reviewed By: quark-zju Differential Revision: D23587932 fbshipit-source-id: 6f47f1605987f9b37f888d29b49a848370d2eb0e
This commit is contained in:
parent
7d230956b7
commit
dca9f7bbfb
@ -95,7 +95,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
|
$(PYTHON3) setup.py $(PURE) build $(COMPILERFLAG)
|
||||||
|
|
||||||
wheel:
|
wheel:
|
||||||
FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
|
FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
|
||||||
@ -109,7 +109,7 @@ getdepsbuild:
|
|||||||
ln -sfn $(GETDEPS_INSTALL_DIR)/rust-shed/source/shed ../../common/rust/shed
|
ln -sfn $(GETDEPS_INSTALL_DIR)/rust-shed/source/shed ../../common/rust/shed
|
||||||
GETDEPS_BUILD=1 \
|
GETDEPS_BUILD=1 \
|
||||||
THRIFT="$(GETDEPS_INSTALL_DIR)/fbthrift/bin/thrift1" \
|
THRIFT="$(GETDEPS_INSTALL_DIR)/fbthrift/bin/thrift1" \
|
||||||
$(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
|
$(PYTHON3) setup.py $(PURE) build $(COMPILERFLAG)
|
||||||
|
|
||||||
cleanbutpackages:
|
cleanbutpackages:
|
||||||
-$(PYTHON) setup.py clean --all # ignore errors from this command
|
-$(PYTHON) setup.py clean --all # ignore errors from this command
|
||||||
@ -131,13 +131,13 @@ clean: cleanbutpackages
|
|||||||
rm -rf packages
|
rm -rf packages
|
||||||
|
|
||||||
install: build
|
install: build
|
||||||
$(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
|
$(PYTHON3) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
|
||||||
|
|
||||||
install-home: build
|
install-home: build
|
||||||
$(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
|
$(PYTHON3) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
|
||||||
|
|
||||||
install-getdeps: getdepsbuild
|
install-getdeps: getdepsbuild
|
||||||
GETDEPS_BUILD=1 $(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
|
GETDEPS_BUILD=1 $(PYTHON3) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
|
||||||
|
|
||||||
check: tests
|
check: tests
|
||||||
|
|
||||||
|
@ -71,7 +71,10 @@ if sys.version_info[0] >= 3:
|
|||||||
libdir_escape = "unicode_escape"
|
libdir_escape = "unicode_escape"
|
||||||
|
|
||||||
def sysstr(s):
|
def sysstr(s):
|
||||||
return s.decode("latin-1")
|
if isinstance(s, bytes):
|
||||||
|
return s.decode("latin-1")
|
||||||
|
else:
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -490,7 +493,7 @@ versionhash = struct.unpack(">Q", hashlib.sha1(versionb).digest()[:8])[0]
|
|||||||
|
|
||||||
chgcflags = ["-std=c99", "-D_GNU_SOURCE", "-DHAVE_VERSIONHASH", "-I%s" % builddir]
|
chgcflags = ["-std=c99", "-D_GNU_SOURCE", "-DHAVE_VERSIONHASH", "-I%s" % builddir]
|
||||||
versionhashpath = pjoin(builddir, "versionhash.h")
|
versionhashpath = pjoin(builddir, "versionhash.h")
|
||||||
write_if_changed(versionhashpath, "#define HGVERSIONHASH %sULL\n" % versionhash)
|
write_if_changed(versionhashpath, b"#define HGVERSIONHASH %dULL\n" % versionhash)
|
||||||
|
|
||||||
write_if_changed(
|
write_if_changed(
|
||||||
"edenscm/mercurial/__version__.py",
|
"edenscm/mercurial/__version__.py",
|
||||||
@ -498,7 +501,7 @@ write_if_changed(
|
|||||||
[
|
[
|
||||||
b"# this file is autogenerated by setup.py\n"
|
b"# this file is autogenerated by setup.py\n"
|
||||||
b'version = "%s"\n' % versionb,
|
b'version = "%s"\n' % versionb,
|
||||||
b"versionhash = %s\n" % versionhash,
|
b"versionhash = %d\n" % versionhash,
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -509,7 +512,7 @@ write_if_changed(
|
|||||||
[
|
[
|
||||||
b"// this file is autogenerated by setup.py\n"
|
b"// this file is autogenerated by setup.py\n"
|
||||||
b'pub static VERSION: &\'static str = "%s";\n' % versionb,
|
b'pub static VERSION: &\'static str = "%s";\n' % versionb,
|
||||||
b"pub static VERSION_HASH: u64 = %s;\n" % versionhash,
|
b"pub static VERSION_HASH: u64 = %d;\n" % versionhash,
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -797,7 +800,7 @@ class thriftasset(asset):
|
|||||||
for thriftdest in sorted(self.sourcemap.values()):
|
for thriftdest in sorted(self.sourcemap.values()):
|
||||||
thriftfile = pjoin(thriftdir, thriftdest)
|
thriftfile = pjoin(thriftdir, thriftdest)
|
||||||
if os.path.exists(thriftfile):
|
if os.path.exists(thriftfile):
|
||||||
with open(thriftfile) as f:
|
with open(thriftfile, "rb") as f:
|
||||||
hasher.update(f.read())
|
hasher.update(f.read())
|
||||||
return int(hasher.hexdigest(), 16)
|
return int(hasher.hexdigest(), 16)
|
||||||
|
|
||||||
@ -1632,25 +1635,25 @@ extmodules += cythonize(
|
|||||||
"edenscmnative.clindex",
|
"edenscmnative.clindex",
|
||||||
sources=["edenscmnative/clindex.pyx"],
|
sources=["edenscmnative/clindex.pyx"],
|
||||||
include_dirs=include_dirs,
|
include_dirs=include_dirs,
|
||||||
extra_compile_args=filter(None, [STDC99, PRODUCEDEBUGSYMBOLS]),
|
extra_compile_args=list(filter(None, [STDC99, PRODUCEDEBUGSYMBOLS])),
|
||||||
),
|
),
|
||||||
Extension(
|
Extension(
|
||||||
"edenscmnative.patchrmdir",
|
"edenscmnative.patchrmdir",
|
||||||
sources=["edenscmnative/patchrmdir.pyx"],
|
sources=["edenscmnative/patchrmdir.pyx"],
|
||||||
include_dirs=include_dirs,
|
include_dirs=include_dirs,
|
||||||
extra_compile_args=filter(None, [PRODUCEDEBUGSYMBOLS]),
|
extra_compile_args=list(filter(None, [PRODUCEDEBUGSYMBOLS])),
|
||||||
),
|
),
|
||||||
Extension(
|
Extension(
|
||||||
"edenscmnative.traceprof",
|
"edenscmnative.traceprof",
|
||||||
sources=["edenscmnative/traceprof.pyx"],
|
sources=["edenscmnative/traceprof.pyx"],
|
||||||
include_dirs=include_dirs,
|
include_dirs=include_dirs,
|
||||||
extra_compile_args=filter(None, [STDCPP11, PRODUCEDEBUGSYMBOLS]),
|
extra_compile_args=list(filter(None, [STDCPP11, PRODUCEDEBUGSYMBOLS])),
|
||||||
),
|
),
|
||||||
Extension(
|
Extension(
|
||||||
"edenscmnative.linelog",
|
"edenscmnative.linelog",
|
||||||
sources=["edenscmnative/linelog.pyx"],
|
sources=["edenscmnative/linelog.pyx"],
|
||||||
include_dirs=include_dirs,
|
include_dirs=include_dirs,
|
||||||
extra_compile_args=filter(None, [STDC99, PRODUCEDEBUGSYMBOLS]),
|
extra_compile_args=list(filter(None, [STDC99, PRODUCEDEBUGSYMBOLS])),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
compiler_directives=cythonopts,
|
compiler_directives=cythonopts,
|
||||||
@ -1664,7 +1667,9 @@ libraries = [
|
|||||||
"depends": ["lib/cdatapack/cdatapack.h"],
|
"depends": ["lib/cdatapack/cdatapack.h"],
|
||||||
"include_dirs": ["."] + include_dirs,
|
"include_dirs": ["."] + include_dirs,
|
||||||
"libraries": ["lz4", SHA1_LIBRARY],
|
"libraries": ["lz4", SHA1_LIBRARY],
|
||||||
"extra_args": filter(None, [STDC99, WALL, WSTRICTPROTOTYPES] + cflags),
|
"extra_args": list(
|
||||||
|
filter(None, [STDC99, WALL, WSTRICTPROTOTYPES] + cflags)
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -1679,7 +1684,9 @@ libraries = [
|
|||||||
"lib/third-party/sha1dc/ubc_check.h",
|
"lib/third-party/sha1dc/ubc_check.h",
|
||||||
],
|
],
|
||||||
"include_dirs": ["lib/third-party"] + include_dirs,
|
"include_dirs": ["lib/third-party"] + include_dirs,
|
||||||
"extra_args": filter(None, [STDC99, WALL, WSTRICTPROTOTYPES] + cflags),
|
"extra_args": list(
|
||||||
|
filter(None, [STDC99, WALL, WSTRICTPROTOTYPES] + cflags)
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -1701,7 +1708,7 @@ if needbuildinfo:
|
|||||||
"buildinfo",
|
"buildinfo",
|
||||||
{
|
{
|
||||||
"sources": [buildinfocpath],
|
"sources": [buildinfocpath],
|
||||||
"extra_args": filter(None, cflags + [WALL, PIC]),
|
"extra_args": list(filter(None, cflags + [WALL, PIC])),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@ -1719,7 +1726,9 @@ if not iswindows:
|
|||||||
],
|
],
|
||||||
"depends": [versionhashpath],
|
"depends": [versionhashpath],
|
||||||
"include_dirs": ["contrib/chg"] + include_dirs,
|
"include_dirs": ["contrib/chg"] + include_dirs,
|
||||||
"extra_args": filter(None, cflags + chgcflags + [STDC99, WALL, PIC]),
|
"extra_args": list(
|
||||||
|
filter(None, cflags + chgcflags + [STDC99, WALL, PIC])
|
||||||
|
),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -1801,8 +1810,11 @@ for root in ("mercurial/templates",):
|
|||||||
# unicode on Python 2 still works because it won't contain any
|
# unicode on Python 2 still works because it won't contain any
|
||||||
# non-ascii bytes and will be implicitly converted back to bytes
|
# non-ascii bytes and will be implicitly converted back to bytes
|
||||||
# when operated on.
|
# when operated on.
|
||||||
assert isinstance(version, bytes)
|
if isinstance(version, bytes):
|
||||||
setupversion = version.decode("ascii")
|
setupversion = version.decode("ascii")
|
||||||
|
else:
|
||||||
|
assert isinstance(version, str)
|
||||||
|
setupversion = version
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
# Windows binary file versions for exe/dll files must have the
|
# Windows binary file versions for exe/dll files must have the
|
||||||
|
Loading…
Reference in New Issue
Block a user