Skip to content

Commit

Permalink
Update devtools/import.py and import/pysam.* for 1.15
Browse files Browse the repository at this point in the history
Exclude samtools/bam2bcf.[ch] which (starting in samtools 1.15) are only
used by bam_tview.c (which we already exclude) and contain functions that
collide with bcftools. Remove obsolete exclusions for removed items.

In import/pysam.h, add prefixes to several more functions that otherwise
conflict between libcsamtools and libcbcftools. Fixes pysam-developers#1081.

In bcftools/regidx.h, add prefixes to all functions, as these conflict
with those provided by htslib/htslib/regidx.h. This is done locally
within bcftools (rather than via import/pysam.h) as this issue may
be resolved in future bcftools imports by PR samtools/bcftools#865.
  • Loading branch information
jmarshall committed Mar 1, 2022
1 parent ff4f717 commit f224d62
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
22 changes: 22 additions & 0 deletions bcftools/regidx.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@
#include <stdio.h>
#include <inttypes.h>

/* Avoid conflicts with HTSlib's regidx_* functions. */
#define regidx_destroy bcftools_regidx_destroy
#define regidx_init bcftools_regidx_init
#define regidx_init_string bcftools_regidx_init_string
#define regidx_insert bcftools_regidx_insert
#define regidx_insert_list bcftools_regidx_insert_list
#define regidx_nregs bcftools_regidx_nregs
#define regidx_overlap bcftools_regidx_overlap
#define regidx_parse_bed bcftools_regidx_parse_bed
#define regidx_parse_reg bcftools_regidx_parse_reg
#define regidx_parse_tab bcftools_regidx_parse_tab
#define regidx_parse_vcf bcftools_regidx_parse_vcf
#define regidx_push bcftools_regidx_push
#define regidx_seq_names bcftools_regidx_seq_names
#define regidx_seq_nregs bcftools_regidx_seq_nregs
#define regitr_copy bcftools_regitr_copy
#define regitr_destroy bcftools_regitr_destroy
#define regitr_init bcftools_regitr_init
#define regitr_loop bcftools_regitr_loop
#define regitr_overlap bcftools_regitr_overlap
#define regitr_reset bcftools_regitr_reset

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
5 changes: 2 additions & 3 deletions devtools/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
EXCLUDE = {
"samtools": (
"test", "misc",
"razip.c",
"bgzip.c",
"main.c",
"calDepth.c",
Expand All @@ -27,8 +26,8 @@
"bam_tview.h",
"bam_tview_html.c",
"bam_tview_curses.c",
"bamcheck.c",
"chk_indel.c",
"bam2bcf.c",
"bam2bcf.h",
"vcf-miniview.c",
),
"bcftools": (
Expand Down
4 changes: 4 additions & 0 deletions import/pysam.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ extern int @pysam@_main(int argc, char *argv[]);
to collisions and wrong functions being called. #define these names so the
actual symbol names include distinct prefixes to avoid collisions.
*/
#define main_consensus @pysam@_main_consensus
#define main_reheader @pysam@_main_reheader
#define bam_smpl_init @pysam@_bam_smpl_init
#define bam_smpl_destroy @pysam@_bam_smpl_destroy
#define read_file_list @pysam@_read_file_list

#endif

Expand Down

0 comments on commit f224d62

Please sign in to comment.