build (client): Remove pygit2 dependency

This commit is contained in:
John Colvin committed 2021-11-20 14:48:32 -05:00
1 parent e389770e55
commit b3db213b1a
2 files changed
+3 -29

No files matched your search

-1
View File
@@ -8,7 +8,6 @@ mccabe==0.6.1
platformdirs==2.3.0
pycodestyle==2.7.0
pycparser==2.20
pygit2==1.6.1
pylint==2.10.2
toml==0.10.2
wrapt==1.12.1
+3 -28
View File
@@ -1,6 +1,5 @@
import argparse
import os
import pygit2
import subprocess
import shutil
@@ -100,14 +99,6 @@ def _get_arg_parser():
nargs='?',
help='The directory in which to put build files')
parser.add_argument(
'--cache-branch',
help='Whether or not to build in a directory named ' +
"'build.<branch_name>' (which is then symlinked to the normal " +
"'build' directory)",
action='store_true',
required=False)
_add_toggle_opt(
parser,
'clean',
@@ -126,20 +117,13 @@ def _rmdir_or_unlink(dir):
shutil.rmtree(dir)
def _create_and_link_build_dir(build_dir, dbuild_dir, clean):
def _create_and_link_build_dir(build_dir, clean):
if not os.path.exists(build_dir):
os.makedirs(build_dir)
elif clean:
_rmdir_or_unlink(build_dir)
os.makedirs(build_dir)
if build_dir != dbuild_dir:
if clean:
_rmdir_or_unlink(dbuild_dir)
elif os.path.islink(dbuild_dir):
os.unlink(dbuild_dir)
os.symlink(build_dir, dbuild_dir)
def _exit(code=0, msg=None):
if msg is not None:
@@ -164,16 +148,8 @@ if __name__ == "__main__":
os.environ[
'spark_build_python_path'] = fr'{SparkPaths.tools()}\..\externals\windows\bin\python'
repo = pygit2.Repository(SparkPaths.root())
args_dict = vars(args)
build_dir = _get_arg(args_dict, 'output_dir')
if build_dir is None:
if _get_arg(args_dict, 'cache_branch'):
branch_name = os.path.basename(repo.head.name)
build_dir = f'build.{branch_name}'
else:
build_dir = SparkPaths.default_build()
build_dir = _get_arg(args_dict, 'output_dir') or SparkPaths.default_build()
clean = args.clean
if build_dir is None:
print(args)
@@ -181,8 +157,7 @@ if __name__ == "__main__":
try:
build_dir = os.path.realpath(build_dir)
dbuild_dir = SparkPaths.default_build()
_create_and_link_build_dir(build_dir, dbuild_dir, clean)
_create_and_link_build_dir(build_dir, clean)
_configure_libspark(build_dir)
except Exception as e:
_exit(e)