Skip to content

Commit

Permalink
Fedora rpm changes (#451)
Browse files Browse the repository at this point in the history
Summary:
Various minor changes to the sapling repo while hacking on Fedora packaging.

These changes works with https://gist.github.com/kiilerix/b32cb9688d2d6e9e752e91e2ca4c30e6 .

Still a long way to go to be able to package offline and reproducible.

Pull Request resolved: #451

Reviewed By: muirdm

Differential Revision: D43327153

Pulled By: quark-zju

fbshipit-source-id: 33326188e17e451c9268038ac783c1fda86db5f8
  • Loading branch information
kiilerix authored and facebook-github-bot committed Feb 17, 2023
1 parent c3b9660 commit 1abfcbc
Showing 1 changed file with 53 additions and 45 deletions.
98 changes: 53 additions & 45 deletions eden/scm/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

# This is the mercurial setup script.
# This is the Sapling setup script.
#
# 'python3 setup.py install', or
# 'python3 setup.py --help' for more options
Expand Down Expand Up @@ -51,6 +51,11 @@

ossbuild = bool(os.environ.get("SAPLING_OSS_BUILD"))

# If this is set, then certain build dependencies like Cython are
# expected to be present and will not be downloaded. Third-party
# dependencies like IPython will not be bundled.
offline = bool(os.environ.get("SAPLING_OFFLINE"))


def ensureenv():
"""Load build/env's as environment variables.
Expand Down Expand Up @@ -537,7 +542,7 @@ def writebuildinfoc():
"""

path = pjoin(builddir, "buildinfo.c")
write_if_changed(path, buildinfosrc)
write_if_changed(path, buildinfosrc.encode())
return path


Expand Down Expand Up @@ -595,6 +600,11 @@ def ensureready(self):
return pjoin(builddir, self.destdir)

def _download(self):
if offline:
raise RuntimeError(
"offline requested via SAPLING_OFFLINE, "
"but downloading required for %s" % self.url
)
destpath = pjoin(builddir, self.name)
if havefb:
# via internal LFS utlity
Expand Down Expand Up @@ -774,28 +784,31 @@ class fetchbuilddeps(Command):
description = "download build depencencies"
user_options = []

pyassets = [
asset(url=url)
for url in [
"https://files.pythonhosted.org/packages/22/a6/858897256d0deac81a172289110f31629fc4cee19b6f01283303e18c8db3/ptyprocess-0.7.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/23/6a/210816c943c9aeeb29e4e18a298f14bf0e118fe222a23e13bfcc2d41b0a4/ipython-7.16.1-py3-none-any.whl",
"https://files.pythonhosted.org/packages/3d/57/4d9c9e3ae9a255cd4e1106bb57e24056d3d0709fc01b2e3e345898e49d5b/simplegeneric-0.8.1.zip",
"https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/44/98/5b86278fbbf250d239ae0ecb724f8572af1c91f4a11edf4d36a206189440/colorama-0.4.4-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/4e/78/56aa1b5f4d8ac548755ae767d84f0be54fdd9d404197a3d9e4659d272348/setuptools-57.0.0-py3-none-any.whl",
"https://files.pythonhosted.org/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/87/61/2dfea88583d5454e3a64f9308a686071d58d59a55db638268a6413e1eb6d/prompt_toolkit-2.0.10-py3-none-any.whl",
"https://files.pythonhosted.org/packages/6a/36/b1b9bfdf28690ae01d9ca0aa5b0d07cb4448ac65fb91dc7e2d094e3d992f/decorator-5.0.9-py3-none-any.whl",
"https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/a6/c9/be11fce9810793676017f79ffab3c6cb18575844a6c7b8d4ed92f95de604/Pygments-2.9.0-py3-none-any.whl",
"https://files.pythonhosted.org/packages/ca/ab/872a23e29cec3cf2594af7e857f18b687ad21039c1f9b922fac5b9b142d5/traitlets-4.3.3-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/fc/56/9f67dcd4a4b9960373173a31be1b8c47fe351a1c9385677a7bdd82810e57/ipdb-0.13.9.tar.gz",
if offline:
pyassets = []
else:
pyassets = [
asset(url=url)
for url in [
"https://files.pythonhosted.org/packages/22/a6/858897256d0deac81a172289110f31629fc4cee19b6f01283303e18c8db3/ptyprocess-0.7.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/23/6a/210816c943c9aeeb29e4e18a298f14bf0e118fe222a23e13bfcc2d41b0a4/ipython-7.16.1-py3-none-any.whl",
"https://files.pythonhosted.org/packages/3d/57/4d9c9e3ae9a255cd4e1106bb57e24056d3d0709fc01b2e3e345898e49d5b/simplegeneric-0.8.1.zip",
"https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/44/98/5b86278fbbf250d239ae0ecb724f8572af1c91f4a11edf4d36a206189440/colorama-0.4.4-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/4e/78/56aa1b5f4d8ac548755ae767d84f0be54fdd9d404197a3d9e4659d272348/setuptools-57.0.0-py3-none-any.whl",
"https://files.pythonhosted.org/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/87/61/2dfea88583d5454e3a64f9308a686071d58d59a55db638268a6413e1eb6d/prompt_toolkit-2.0.10-py3-none-any.whl",
"https://files.pythonhosted.org/packages/6a/36/b1b9bfdf28690ae01d9ca0aa5b0d07cb4448ac65fb91dc7e2d094e3d992f/decorator-5.0.9-py3-none-any.whl",
"https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/a6/c9/be11fce9810793676017f79ffab3c6cb18575844a6c7b8d4ed92f95de604/Pygments-2.9.0-py3-none-any.whl",
"https://files.pythonhosted.org/packages/ca/ab/872a23e29cec3cf2594af7e857f18b687ad21039c1f9b922fac5b9b142d5/traitlets-4.3.3-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl",
"https://files.pythonhosted.org/packages/fc/56/9f67dcd4a4b9960373173a31be1b8c47fe351a1c9385677a7bdd82810e57/ipdb-0.13.9.tar.gz",
]
]
]

# These pyassets are eden and thrift related. We don't use those in open
# source for now.
Expand Down Expand Up @@ -1095,7 +1108,10 @@ def run(self):

build_py.run(self)

buildpyzip(self.distribution).run()
# This builds the 3rd-party pure Python dependencies into
# a zip. It is not needed for offline (prefer system-dep) build.
if not offline:
buildpyzip(self.distribution).run()


class buildpyzip(Command):
Expand Down Expand Up @@ -1329,7 +1345,8 @@ def _installpyzip(self):
for src, dst in [("edenscmdeps3.zip", "edenscmdeps3.zip")]:
srcpath = pjoin(builddir, src)
dstpath = pjoin(self.install_dir, dst)
file_util.copy_file(srcpath, dstpath)
if os.path.exists(srcpath):
file_util.copy_file(srcpath, dstpath)


class hginstallscripts(install_scripts):
Expand Down Expand Up @@ -1585,11 +1602,12 @@ def distutils_dir_name(dname):

def cythonize(*args, **kwargs):
"""Proxy to Cython.Build.cythonize. Download Cython on demand."""
cythonsrc = asset(
url="https://files.pythonhosted.org/packages/4c/76/1e41fbb365ad20b6efab2e61b0f4751518444c953b390f9b2d36cf97eea0/Cython-0.29.32.tar.gz"
)
path = cythonsrc.ensureready()
sys.path.insert(0, path)
if not offline:
cythonsrc = asset(
url="https://files.pythonhosted.org/packages/4c/76/1e41fbb365ad20b6efab2e61b0f4751518444c953b390f9b2d36cf97eea0/Cython-0.29.32.tar.gz"
)
path = cythonsrc.ensureready()
sys.path.insert(0, path)

from Cython.Build import cythonize

Expand Down Expand Up @@ -1866,31 +1884,21 @@ def build_libraries(self, libraries):
name="edenscm",
version=setupversion,
author="Olivia Mackall and many others",
author_email="mercurial@mercurial-scm.org",
url="https://mercurial-scm.org/",
download_url="https://mercurial-scm.org/release/",
url="https://sapling-scm.com/",
description=(
"Fast scalable distributed SCM (revision control, version " "control) system"
"Sapling SCM is a cross-platform, highly scalable, Git-compatible source control system."
),
long_description=(
"Mercurial is a distributed SCM tool written in Python."
" It is used by a number of large projects that require"
" fast, reliable distributed revision control, such as "
"Mozilla."
"It aims to provide both user-friendly and powerful interfaces for users, as "
"well as extreme scalability to deal with repositories containing many millions "
"of files and many millions of commits."
),
license="GNU GPLv2 or any later version",
classifiers=[
"Development Status :: 6 - Mature",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Natural Language :: Danish",
"Natural Language :: English",
"Natural Language :: German",
"Natural Language :: Italian",
"Natural Language :: Japanese",
"Natural Language :: Portuguese (Brazilian)",
"Operating System :: Microsoft :: Windows",
"Operating System :: OS Independent",
"Operating System :: POSIX",
Expand Down

0 comments on commit 1abfcbc

Please sign in to comment.