diff --git a/buildutils/bundle.py b/buildutils/bundle.py index 0a3848167..3dfd5ed06 100644 --- a/buildutils/bundle.py +++ b/buildutils/bundle.py @@ -24,10 +24,6 @@ from urllib.parse import urlparse from urllib.request import urlopen -from git import Repo -from git.exc import InvalidGitRepositoryError, NoSuchPathError -from gitdb.exc import BadName - from .msg import fatal, info, warn pjoin = os.path.join @@ -181,7 +177,10 @@ def handle_remove_readonly(func, path, exc): raise -def fetch_libzmq_repo_zip(savedir, url): +def fetch_libzmq_archive(savedir, url): + """fetch libzmq from archive zip""" + dest = pjoin(savedir, 'zeromq') + fetch_path = urlparse(url) fetch_name = os.path.basename(fetch_path.path) dest = pjoin(savedir, 'zeromq') @@ -189,41 +188,12 @@ def fetch_libzmq_repo_zip(savedir, url): # checks for a file with the name of the zip archive if os.path.exists(fname_file): info("already have extracted sources from repo archive %s" % fetch_name) - return else: if os.path.exists(dest): shutil.rmtree(dest, ignore_errors=False, onerror=handle_remove_readonly) fetch_and_extract(savedir, 'zeromq', url=url, fname=fetch_name, checksum=None) - open(fname_file, 'a') # touch the file with the name of the zip archive - - -def fetch_libzmq_repo(savedir, url, ref): - """fetch libzmq from repo""" - dest = pjoin(savedir, 'zeromq') - - if url.endswith('.zip'): - fetch_libzmq_repo_zip(savedir, url) - else: - try: - repo = Repo(dest) - except (InvalidGitRepositoryError, NoSuchPathError): - info("invalid local repo, clone from %s" % url) - if os.path.exists(dest): - shutil.rmtree(dest, ignore_errors=False, onerror=handle_remove_readonly) - repo = Repo.clone_from(url, dest) - - if ref: - try: - commit = repo.commit(ref) - except BadName: - warn("invalid ref %s" % ref) - else: - if repo.head.commit != commit: - info("checking out %s" % ref) - repo.head.reference = commit - repo.head.reset(index=True, working_tree=True) - else: - info("repo head is already %s" % ref) + with open(fname_file, 'a'): # touch the file with the name of the zip archive + pass # get repo version zmq_hdr = pjoin(dest, 'include', 'zmq.h') diff --git a/buildutils/config.py b/buildutils/config.py index bbf63ad1c..a38eefe36 100644 --- a/buildutils/config.py +++ b/buildutils/config.py @@ -119,25 +119,12 @@ def config_from_prefix(prefix): settings['zmq_prefix'] = '' settings['libzmq_extension'] = True settings['no_libzmq_extension'] = False - settings['zmq_repo_url'] = None - settings['zmq_repo_ref'] = None - elif prefix_lower.startswith('git@'): - settings['zmq_prefix'] = '' - settings['libzmq_extension'] = True - settings['no_libzmq_extension'] = False - - prefix_split = prefix.split('@', 2) - settings['zmq_repo_url'] = prefix_split[1] - if len(prefix_split) > 2: - settings['zmq_repo_ref'] = prefix_split[2] - else: - settings['zmq_repo_ref'] = None + settings['zmq_archive_url'] = None elif prefix_lower.startswith('https://') and prefix_lower.endswith('.zip'): settings['zmq_prefix'] = '' settings['libzmq_extension'] = True settings['no_libzmq_extension'] = False - settings['zmq_repo_url'] = prefix_lower - settings['zmq_repo_ref'] = None + settings['zmq_archive_url'] = prefix_lower else: settings['zmq_prefix'] = os.path.abspath(prefix) settings['libzmq_extension'] = False @@ -177,8 +164,7 @@ def discover_settings(conf_base=None): 'build_ext': {}, 'bdist_egg': {}, 'win_ver': None, - 'zmq_repo_url': None, - 'zmq_repo_ref': None, + 'zmq_archive_url': None, } if sys.platform.startswith('win'): settings['have_sys_un_h'] = False diff --git a/pyproject.toml b/pyproject.toml index 4fb1d7383..a5f176e09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,6 @@ requires = [ "setuptools_scm[toml]", "wheel", "packaging", - "GitPython", "cffi; implementation_name == 'pypy'", "cython>=0.29; implementation_name == 'cpython'", "cython>=0.29.35; implementation_name == 'cpython' and python_version >= '3.12'", diff --git a/setup.py b/setup.py index d5253488a..86ea3054d 100755 --- a/setup.py +++ b/setup.py @@ -51,8 +51,8 @@ discover_settings, fatal, fetch_libzmq, + fetch_libzmq_archive, fetch_libzmq_dll, - fetch_libzmq_repo, info, line, localpath, @@ -538,9 +538,9 @@ def bundle_libzmq_extension(self): if not os.path.exists(bundledir): os.makedirs(bundledir) - if self.config['zmq_repo_url']: - repo_version = fetch_libzmq_repo( - bundledir, self.config['zmq_repo_url'], self.config['zmq_repo_ref'] + if self.config['zmq_archive_url']: + repo_version = fetch_libzmq_archive( + bundledir, self.config['zmq_archive_url'] ) if repo_version and repo_version != bundled_version: bundled_version = repo_version