Compare commits
No commits in common. "b6c32fbd3ccc58d3bd3941dbffa48417e1f74861" and "57308cac7ddaa294331157b78cf406a7556e9428" have entirely different histories.
b6c32fbd3c
...
57308cac7d
1
.gitignore
vendored
1
.gitignore
vendored
@ -176,4 +176,3 @@ pyrightconfig.json
|
|||||||
# End of https://www.toptal.com/developers/gitignore/api/python
|
# End of https://www.toptal.com/developers/gitignore/api/python
|
||||||
|
|
||||||
autobigs-engine/*
|
autobigs-engine/*
|
||||||
bioconda-recipes/*
|
|
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@ -4,13 +4,7 @@
|
|||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
|
||||||
"name": "Python Debugger: Current File",
|
|
||||||
"type": "debugpy",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${file}",
|
|
||||||
"console": "integratedTerminal"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Python Debugger: Current File with Arguments",
|
"name": "Python Debugger: Current File with Arguments",
|
||||||
"type": "debugpy",
|
"type": "debugpy",
|
||||||
|
25
Jenkinsfile
vendored
25
Jenkinsfile
vendored
@ -11,8 +11,8 @@ pipeline {
|
|||||||
parallel {
|
parallel {
|
||||||
stage("recipes repo") {
|
stage("recipes repo") {
|
||||||
steps {
|
steps {
|
||||||
sh 'git clone https://github.com/Syph-and-VPD-Lab/auto-updated-bioconda-recipes.git'
|
sh 'git clone https://github.com/Syph-and-VPD-Lab/bioconda-recipes.git'
|
||||||
dir('auto-updated-bioconda-recipes') {
|
dir('bioconda-recipes') {
|
||||||
sh 'git pull'
|
sh 'git pull'
|
||||||
sh 'git pull origin update-autobigs-engine'
|
sh 'git pull origin update-autobigs-engine'
|
||||||
sh 'git checkout update-autobigs-engine'
|
sh 'git checkout update-autobigs-engine'
|
||||||
@ -28,21 +28,13 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage("generate recipe") {
|
stage("generate recipe") {
|
||||||
steps {
|
steps {
|
||||||
sh 'grayskull pypi autoBIGS.engine --maintainers "Harrison Deng"'
|
sh 'grayskull pypi autobigs.engine --maintainers "Harrison Deng"'
|
||||||
sh 'python patch_recipe.py'
|
sh 'python scripts/adapt_names.py autobigs.engine'
|
||||||
sh 'cp -r autobigs-engine/* auto-updated-bioconda-recipes/recipes/autobigs-engine/.'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage("lint") {
|
|
||||||
steps {
|
|
||||||
dir('auto-updated-bioconda-recipes') {
|
|
||||||
sh 'bioconda-utils lint recipes/ --packages autobigs-engine'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage("build") {
|
stage("build") {
|
||||||
steps {
|
steps {
|
||||||
sh 'conda build bioconda-utils/recipes/autobigs-engine'
|
sh 'conda build autobigs-engine'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage("commit") {
|
stage("commit") {
|
||||||
@ -50,9 +42,10 @@ pipeline {
|
|||||||
TOKEN = credentials('github.com')
|
TOKEN = credentials('github.com')
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
dir('auto-updated-bioconda-recipes') {
|
dir('bioconda-recipes') {
|
||||||
sh 'git commit -a -m "Automatically updated autobigs-engine bioconda recipe to $(python ../pypi_latest_ver.py autoBIGS.engine)."'
|
sh 'cp -r ../autobigs-engine/* recipes/autobigs-engine/.'
|
||||||
sh 'git push https://${TOKEN}@github.com/Syph-and-VPD-Lab/auto-updated-bioconda-recipes.git update-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 https://${TOKEN}@github.com/Syph-and-VPD-Lab/bioconda-recipes.git update-autobigs-engine'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
50
autobigs-cli/meta.yaml
Normal file
50
autobigs-cli/meta.yaml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{% set name = "autoBIGS.cli" %}
|
||||||
|
{% set version = "0.4.2" %}
|
||||||
|
|
||||||
|
package:
|
||||||
|
name: {{ name|lower|replace(".", "-") }}
|
||||||
|
version: {{ version }}
|
||||||
|
|
||||||
|
source:
|
||||||
|
url: https://pypi.org/packages/source/{{ name[0] }}/{{ name }}/autobigs_cli-{{ version }}.tar.gz
|
||||||
|
sha256: fc7bf6c604974796f5c8aae52fd9ab9924f5490f4f207a26be803217aae30c82
|
||||||
|
|
||||||
|
build:
|
||||||
|
entry_points:
|
||||||
|
- autoBIGS = autobigs.cli.program:run
|
||||||
|
noarch: python
|
||||||
|
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
|
||||||
|
number: 0
|
||||||
|
run_exports:
|
||||||
|
- {{ pin_subpackage( name|lower|replace(".", "-"), max_pin="x.x") }}
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
host:
|
||||||
|
- python >=3.12
|
||||||
|
- setuptools >=64
|
||||||
|
- setuptools-scm >=8
|
||||||
|
- pip
|
||||||
|
run:
|
||||||
|
- python >=3.12
|
||||||
|
- autobigs-engine
|
||||||
|
|
||||||
|
test:
|
||||||
|
imports:
|
||||||
|
- autobigs
|
||||||
|
commands:
|
||||||
|
- pip check
|
||||||
|
- autoBIGS --help
|
||||||
|
- autoBIGS info -h
|
||||||
|
- autoBIGS st -h
|
||||||
|
requires:
|
||||||
|
- pip
|
||||||
|
|
||||||
|
about:
|
||||||
|
home: https://github.com/RealYHD/autoBIGS.cli
|
||||||
|
summary: A CLI tool to rapidly fetch fetch MLST profiles given sequences for various diseases.
|
||||||
|
license: GPL-3.0-or-later
|
||||||
|
license_file: LICENSE
|
||||||
|
|
||||||
|
extra:
|
||||||
|
recipe-maintainers:
|
||||||
|
- Harrison Deng
|
1
bioconda-recipes
Submodule
1
bioconda-recipes
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit bca9514062303e6470b9dbb628b02f76f8de258d
|
@ -6,5 +6,3 @@ dependencies:
|
|||||||
- conda-build
|
- conda-build
|
||||||
- grayskull
|
- grayskull
|
||||||
- git
|
- git
|
||||||
- bioconda-utils
|
|
||||||
- python=3.10.*
|
|
103
patch_recipe.py
103
patch_recipe.py
@ -1,103 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
from os import fdopen, path
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import shutil
|
|
||||||
from sys import argv
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
INDENTATION = " "
|
|
||||||
GRAYSKULL_OUTPUT_PATH = "autoBIGS.engine"
|
|
||||||
RUN_EXPORTED_VALUE = r'{{ pin_subpackage( name|lower|replace(".", "-"), max_pin="x.x") }}'
|
|
||||||
LICENSE_SUFFIX = "-or-later"
|
|
||||||
HOME_PAGE = "https://github.com/Syph-and-VPD-Lab/autoBIGS.engine"
|
|
||||||
|
|
||||||
def _calc_indentation(line: str):
|
|
||||||
return len(re.findall(INDENTATION, line.split(line.strip())[0])) if line != "\n" else 0
|
|
||||||
|
|
||||||
def read_grayskull_output():
|
|
||||||
original_recipe = path.abspath(GRAYSKULL_OUTPUT_PATH)
|
|
||||||
original_meta = path.join(original_recipe, "meta.yaml")
|
|
||||||
meta_file = open(original_meta)
|
|
||||||
lines = meta_file.readlines()
|
|
||||||
meta_file.close()
|
|
||||||
return lines
|
|
||||||
|
|
||||||
def update_naming_scheme(lines):
|
|
||||||
modified_lines = []
|
|
||||||
for line in lines:
|
|
||||||
matches = re.finditer(r"\{\{\s*name\|lower()\s+\}\}", line)
|
|
||||||
modified_line = line
|
|
||||||
for match in matches:
|
|
||||||
modified_line = modified_line[:match.start(1)] + r'|replace(".", "-")' + modified_line[match.end(1):]
|
|
||||||
modified_lines.append(modified_line)
|
|
||||||
return modified_lines
|
|
||||||
|
|
||||||
def inject_run_exports(lines: list[str]):
|
|
||||||
package_indent = False
|
|
||||||
modified_lines = []
|
|
||||||
for line in lines:
|
|
||||||
indentation_count = _calc_indentation(line)
|
|
||||||
if line == "build:\n" and indentation_count == 0:
|
|
||||||
package_indent = True
|
|
||||||
modified_lines.append(line)
|
|
||||||
elif package_indent and indentation_count == 0:
|
|
||||||
modified_lines.append(INDENTATION*1 + "run_exports:\n")
|
|
||||||
modified_lines.append(INDENTATION*2 + "- " + RUN_EXPORTED_VALUE + "\n")
|
|
||||||
package_indent = False
|
|
||||||
else:
|
|
||||||
modified_lines.append(line)
|
|
||||||
return modified_lines
|
|
||||||
|
|
||||||
def suffix_license(lines: list[str]):
|
|
||||||
about_indent = False
|
|
||||||
modified_lines = []
|
|
||||||
for line in lines:
|
|
||||||
indentation_count = _calc_indentation(line)
|
|
||||||
if line == "about:\n" and indentation_count == 0:
|
|
||||||
about_indent = True
|
|
||||||
modified_lines.append(line)
|
|
||||||
elif about_indent and indentation_count == 1 and line.lstrip().startswith("license:"):
|
|
||||||
modified_lines.append(line.rstrip() + LICENSE_SUFFIX + "\n")
|
|
||||||
about_indent = False
|
|
||||||
else:
|
|
||||||
modified_lines.append(line)
|
|
||||||
return modified_lines
|
|
||||||
|
|
||||||
def inject_home_page(lines: list[str]):
|
|
||||||
about_indent = False
|
|
||||||
modified_lines = []
|
|
||||||
for line in lines:
|
|
||||||
indentation_count = _calc_indentation(line)
|
|
||||||
if line == "about:\n" and indentation_count == 0:
|
|
||||||
about_indent = True
|
|
||||||
modified_lines.append(line)
|
|
||||||
elif about_indent and indentation_count == 0:
|
|
||||||
modified_lines.append(INDENTATION + "home: " + HOME_PAGE + "\n")
|
|
||||||
about_indent = False
|
|
||||||
else:
|
|
||||||
modified_lines.append(line)
|
|
||||||
return modified_lines
|
|
||||||
|
|
||||||
def write_to_original(lines: list[str]):
|
|
||||||
original_recipe = path.abspath(GRAYSKULL_OUTPUT_PATH)
|
|
||||||
original_meta = path.join(original_recipe, "meta.yaml")
|
|
||||||
with open(original_meta, "w") as file:
|
|
||||||
file.writelines(lines)
|
|
||||||
|
|
||||||
def rename_recipe_dir():
|
|
||||||
new_recipe_name = path.abspath(path.join(GRAYSKULL_OUTPUT_PATH.replace(".", "-").lower()))
|
|
||||||
shutil.rmtree(new_recipe_name, ignore_errors=True)
|
|
||||||
os.replace(path.abspath(GRAYSKULL_OUTPUT_PATH), new_recipe_name)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
original_grayskull_out = read_grayskull_output()
|
|
||||||
modified_recipe_meta = None
|
|
||||||
modified_recipe_meta = update_naming_scheme(original_grayskull_out)
|
|
||||||
modified_recipe_meta = inject_run_exports(modified_recipe_meta)
|
|
||||||
modified_recipe_meta = suffix_license(modified_recipe_meta)
|
|
||||||
modified_recipe_meta = inject_home_page(modified_recipe_meta)
|
|
||||||
write_to_original(modified_recipe_meta)
|
|
||||||
rename_recipe_dir()
|
|
32
scripts/adapt_names.py
Executable file
32
scripts/adapt_names.py
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from os import fdopen, path
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
from sys import argv
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
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:
|
||||||
|
with open(original_meta, "r") as original_file_handle:
|
||||||
|
for line in original_file_handle:
|
||||||
|
matches = re.finditer(r"\{\{\s*name\|lower()\s+\}\}", line)
|
||||||
|
modified_line = line
|
||||||
|
for match in matches:
|
||||||
|
modified_line = modified_line[:match.start(1)] + r'|replace(".", "-")' + modified_line[match.end(1):]
|
||||||
|
new_file_handle.write(modified_line)
|
||||||
|
shutil.move(new_file_path, original_meta)
|
||||||
|
new_recipe_name = path.join(
|
||||||
|
path.dirname(original_recipe),
|
||||||
|
path.basename(original_recipe).replace(".", "-").lower())
|
||||||
|
shutil.rmtree(new_recipe_name, ignore_errors=True)
|
||||||
|
os.replace(original_recipe,
|
||||||
|
new_recipe_name)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
update_naming_scheme(argv[1])
|
1
pypi_latest_ver.py → scripts/package_latest_version.py
Normal file → Executable file
1
pypi_latest_ver.py → scripts/package_latest_version.py
Normal file → Executable file
@ -8,7 +8,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from pip._vendor.packaging.version import parse
|
from pip._vendor.packaging.version import parse
|
||||||
|
|
||||||
# Courtesy of https://stackoverflow.com/questions/28774852/pypi-api-how-to-get-stable-package-version
|
|
||||||
|
|
||||||
URL_PATTERN = 'https://pypi.python.org/pypi/{package}/json'
|
URL_PATTERN = 'https://pypi.python.org/pypi/{package}/json'
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user