Re-merged separation process and finished initial Jenkins pipeline

This commit is contained in:
Harrison Deng 2025-02-17 15:50:33 +00:00
parent 9d117a37ea
commit 76455011db
3 changed files with 45 additions and 6 deletions

13
Jenkinsfile vendored
View File

@ -15,7 +15,7 @@ pipeline {
dir('bioconda-recipes') {
sh 'git pull'
sh 'git pull origin update-autobigs-engine'
sh 'git pull origin update-autobigs-engine'
sh 'git pull origin update-autobigs-cli'
}
}
}
@ -44,8 +44,15 @@ pipeline {
stage("overwrite") {
steps {
dir('bioconda-recipes') {
sh 'checkout '
sh 'cp autobigs-engine/* '
sh 'git checkout -b update-autobigs-engine'
sh 'cp -r ../autobigs-engine/* recipes/autobigs-engine/.'
sh 'git commit -a -m "Automatically updated autobigs-engine bioconda recipe to $(python ../scripts/package_latest_version.py autoBIGS.engine)."'
sh 'git push origin update-autobigs-engine'
sh 'git checkout -b update-autobigs-cli'
sh 'cp -r ../autobigs-engine/* recipes/autobigs-cli/.'
sh 'git commit -a -m "Automatically updated autobigs-cli bioconda recipe to $(python ../scripts/package_latest_version.py autoBIGS.engine)."'
sh 'git push origin update-autobigs-cli'
}
}
}

8
scripts/adapt_names.py Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/env python3
import argparse
from os import fdopen, path
import os
@ -6,8 +8,8 @@ import shutil
from sys import argv
import tempfile
def main():
original_recipe = path.abspath(argv[1])
def update_naming_scheme(recipe_path):
original_recipe = path.abspath(recipe_path)
original_meta = path.join(original_recipe, "meta.yaml")
new_fd, new_file_path = tempfile.mkstemp()
with fdopen(new_fd, "w") as new_file_handle:
@ -27,4 +29,4 @@ def main():
new_recipe_name)
if __name__ == "__main__":
main()
update_naming_scheme(argv[1])

View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import sys
import requests
import json
try:
from packaging.version import parse
except ImportError:
from pip._vendor.packaging.version import parse
URL_PATTERN = 'https://pypi.python.org/pypi/{package}/json'
def get_version(package, url_pattern=URL_PATTERN):
"""Return version of package on pypi.python.org using json."""
req = requests.get(url_pattern.format(package=package))
version = parse('0')
if req.status_code == requests.codes.ok:
j = json.loads(req.text.encode(req.encoding or "utf-8"))
releases = j.get('releases', [])
for release in releases:
ver = parse(release)
if not ver.is_prerelease:
version = max(version, ver)
return version
if __name__ == '__main__':
print(get_version(sys.argv[1]), end="")