[med-svn] [spades] 01/03: Use a sed command to fix yaml import statements to use the Debian package

Afif Elghraoui afif at moszumanska.debian.org
Sun Mar 20 06:24:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

afif pushed a commit to branch master
in repository spades.

commit f8c160f87715ae9bab8fa06921ceccf981b5d625
Author: Afif Elghraoui <afif at ghraoui.name>
Date:   Sat Mar 19 22:51:16 2016 -0700

    Use a sed command to fix yaml import statements to use the Debian package
    
    The quilt patch is an unstable solution, as new releases may
    add new files with more import statements that need to be fixed.
    Applying the sed command to the build directory should catch any new
    instances that need to be fixed.
---
 .../0001_use_debian_packaged_python-yaml.patch     | 96 ----------------------
 debian/patches/0003_accept-system-bwa.patch        | 12 +--
 .../0101_cmake_ignore_removed_python-yaml.patch    |  4 +-
 .../0102_cmake_ignore_removed_python-joblib.patch  |  4 +-
 debian/patches/0103_use-debian-packaged-bwa.patch  |  4 +-
 debian/patches/0110_build_single_thread.patch      |  4 +-
 debian/patches/0111_use_full_config_dirs.patch     | 16 ++--
 debian/patches/0112_spelling.patch                 | 16 ++--
 debian/patches/0113_adjust_paths.patch             |  8 +-
 debian/patches/0114_use_debian_provided_libs.patch | 20 ++---
 debian/patches/series                              |  1 -
 debian/rules                                       |  5 ++
 12 files changed, 49 insertions(+), 141 deletions(-)

diff --git a/debian/patches/0001_use_debian_packaged_python-yaml.patch b/debian/patches/0001_use_debian_packaged_python-yaml.patch
deleted file mode 100644
index 252a72f..0000000
--- a/debian/patches/0001_use_debian_packaged_python-yaml.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-Author: Andreas Tille <tille at debian.org>
-Last-Changed: Tue, 03 Mar 2015 20:55:53 +0100
-Description: We are using Debian packaged python-yaml
- Debian has its own way to distinguish Python versions and there is no point
- in doing this inside the code.
- .
- The patch is non-intrusive since it conserves the original code and uses
- Debian pyyaml only if the original method fails.
-
---- a/spades.py
-+++ b/spades.py
-@@ -34,10 +34,7 @@
- import spades_logic
- import options_storage
- addsitedir(ext_python_modules_home)
--if sys.version.startswith('2.'):
--    import pyyaml2 as pyyaml
--elif sys.version.startswith('3.'):
--    import pyyaml3 as pyyaml
-+import yaml as pyyaml
- 
- import moleculo_postprocessing
- import alignment
---- a/src/spades_pipeline/hammer_logic.py
-+++ b/src/spades_pipeline/hammer_logic.py
-@@ -76,10 +76,7 @@
- 
- def prepare_config_ih(filename, cfg, ext_python_modules_home):
-     addsitedir(ext_python_modules_home)
--    if sys.version.startswith('2.'):
--        import pyyaml2 as pyyaml
--    elif sys.version.startswith('3.'):
--        import pyyaml3 as pyyaml
-+    import yaml as pyyaml
- 
-     data = pyyaml.load(open(filename, 'r'))
-     data["dataset"] = cfg.dataset_yaml_filename
-@@ -93,10 +90,7 @@
- def run_hammer(corrected_dataset_yaml_filename, configs_dir, execution_home, cfg,
-                not_used_dataset_data, ext_python_modules_home, log):
-     addsitedir(ext_python_modules_home)
--    if sys.version.startswith('2.'):
--        import pyyaml2 as pyyaml
--    elif sys.version.startswith('3.'):
--        import pyyaml3 as pyyaml
-+    import yaml as pyyaml
-     dst_configs = os.path.join(cfg.output_dir, "configs")
-     if os.path.exists(dst_configs):
-         shutil.rmtree(dst_configs)
-@@ -145,4 +139,4 @@
-     log.info("\n== Dataset description file was created: " + corrected_dataset_yaml_filename + "\n")
- 
-     if os.path.isdir(cfg.tmp_dir):
--        shutil.rmtree(cfg.tmp_dir)
-\ No newline at end of file
-+        shutil.rmtree(cfg.tmp_dir)
---- a/src/spades_pipeline/spades_logic.py
-+++ b/src/spades_pipeline/spades_logic.py
-@@ -70,10 +70,7 @@
-     max_read_length = 0
-     if os.path.isfile(est_params_filename):
-         addsitedir(ext_python_modules_home)
--        if sys.version.startswith('2.'):
--            import pyyaml2 as pyyaml
--        elif sys.version.startswith('3.'):
--            import pyyaml3 as pyyaml
-+        import yaml as pyyaml
-         est_params_data = pyyaml.load(open(est_params_filename, 'r'))
-         for reads_library in est_params_data:
-             if reads_library['type'] in READS_TYPES_USED_IN_CONSTRUCTION:
---- a/src/spades_pipeline/corrector_logic.py
-+++ b/src/spades_pipeline/corrector_logic.py
-@@ -19,10 +19,7 @@
- 
- def prepare_config_corr(filename, cfg, ext_python_modules_home):
-     addsitedir(ext_python_modules_home)
--    if sys.version.startswith('2.'):
--        import pyyaml2 as pyyaml
--    elif sys.version.startswith('3.'):
--        import pyyaml3 as pyyaml
-+    import yaml as pyyaml
-     data = pyyaml.load(open(filename, 'r'))
-     data["dataset"] = cfg.dataset
-     data["output_dir"] = cfg.output_dir
-@@ -39,10 +36,7 @@
- def run_corrector(configs_dir, execution_home, cfg,
-                 ext_python_modules_home, log, to_correct, result):
-     addsitedir(ext_python_modules_home)
--    if sys.version.startswith('2.'):
--        import pyyaml2 as pyyaml
--    elif sys.version.startswith('3.'):
--        import pyyaml3 as pyyaml
-+    import yaml as pyyaml
- 
-     dst_configs = os.path.join(cfg.output_dir, "configs")
-     if os.path.exists(dst_configs):
diff --git a/debian/patches/0003_accept-system-bwa.patch b/debian/patches/0003_accept-system-bwa.patch
index 00f1ac4..e015d2b 100644
--- a/debian/patches/0003_accept-system-bwa.patch
+++ b/debian/patches/0003_accept-system-bwa.patch
@@ -13,8 +13,8 @@ Description: Enable using Debian packaged bwa instead of bwa-spades
  In case you consider taking over the patch I'd suggest to take it over into
  some common import file.
 
---- a/src/spades_pipeline/support.py
-+++ b/src/spades_pipeline/support.py
+--- spades.orig/src/spades_pipeline/support.py
++++ spades/src/spades_pipeline/support.py
 @@ -58,6 +58,22 @@
          sys.stdout.write("\n\n" + prefix + " " + warn_str + "\n\n\n")
          sys.stdout.flush()
@@ -55,9 +55,9 @@ Description: Enable using Debian packaged bwa instead of bwa-spades
  
  def check_file_existence(input_filename, message="", log=None, dipspades=False):
      filename = abspath(expanduser(input_filename))
---- a/spades.py
-+++ b/spades.py
-@@ -146,6 +146,22 @@
+--- spades.orig/spades.py
++++ spades/spades.py
+@@ -149,6 +149,22 @@
      print_value(cfg, "common", "max_memory", "Memory limit (in Gb)", "  ")
      log.info("")
  
@@ -80,7 +80,7 @@ Description: Enable using Debian packaged bwa instead of bwa-spades
  
  def fill_cfg(options_to_parse, log, secondary_filling=False):
      skip_output_dir=secondary_filling
-@@ -426,7 +442,11 @@
+@@ -429,7 +445,11 @@
      if (not options_storage.only_error_correction) and options_storage.mismatch_corrector:
          cfg["mismatch_corrector"] = empty_config()
          cfg["mismatch_corrector"].__dict__["skip-masked"] = None
diff --git a/debian/patches/0101_cmake_ignore_removed_python-yaml.patch b/debian/patches/0101_cmake_ignore_removed_python-yaml.patch
index 30415e2..d1b93fe 100644
--- a/debian/patches/0101_cmake_ignore_removed_python-yaml.patch
+++ b/debian/patches/0101_cmake_ignore_removed_python-yaml.patch
@@ -4,8 +4,8 @@ Description: Since we are using Debian packaged python-yaml
  (see 0001_use_debian_packaged_python-yaml.patch) the dir needs to be
  excluded
 
---- a/ext/src/CMakeLists.txt
-+++ b/ext/src/CMakeLists.txt
+--- spades.orig/ext/src/CMakeLists.txt
++++ spades/ext/src/CMakeLists.txt
 @@ -4,8 +4,6 @@
  add_subdirectory(nlopt)
  add_subdirectory(python_libs/joblib2)
diff --git a/debian/patches/0102_cmake_ignore_removed_python-joblib.patch b/debian/patches/0102_cmake_ignore_removed_python-joblib.patch
index 64812ab..1a1a1cc 100644
--- a/debian/patches/0102_cmake_ignore_removed_python-joblib.patch
+++ b/debian/patches/0102_cmake_ignore_removed_python-joblib.patch
@@ -4,8 +4,8 @@ Description: Since we are using Debian packaged python-joblib
  (see 0002_use_debian_packaged_python-joblib.patch) the dir needs to be
  excluded
 
---- a/ext/src/CMakeLists.txt
-+++ b/ext/src/CMakeLists.txt
+--- spades.orig/ext/src/CMakeLists.txt
++++ spades/ext/src/CMakeLists.txt
 @@ -2,8 +2,6 @@
  
  add_subdirectory(jemalloc)
diff --git a/debian/patches/0103_use-debian-packaged-bwa.patch b/debian/patches/0103_use-debian-packaged-bwa.patch
index 9355359..91a0168 100644
--- a/debian/patches/0103_use-debian-packaged-bwa.patch
+++ b/debian/patches/0103_use-debian-packaged-bwa.patch
@@ -13,8 +13,8 @@ Description: SPAdes originally contained a code copy of bwa since the version
     ln -s /usr/bin/bwa /usr/lib/spades/bin/bwa-spades
  which enables successfull run of the test suite
 
---- a/ext/tools/CMakeLists.txt
-+++ b/ext/tools/CMakeLists.txt
+--- spades.orig/ext/tools/CMakeLists.txt
++++ spades/ext/tools/CMakeLists.txt
 @@ -5,4 +5,3 @@
  # See file LICENSE for details.
  ############################################################################
diff --git a/debian/patches/0110_build_single_thread.patch b/debian/patches/0110_build_single_thread.patch
index 3fa81dd..bf0599a 100644
--- a/debian/patches/0110_build_single_thread.patch
+++ b/debian/patches/0110_build_single_thread.patch
@@ -1,8 +1,8 @@
 Description: build in single thread
  Upstream builds this in 8 threads, which might overwhelm weaker machines.
 Author: Sascha Steinbiss <sascha at steinbiss.name>
---- a/spades_compile.sh
-+++ b/spades_compile.sh
+--- spades.orig/spades_compile.sh
++++ spades/spades_compile.sh
 @@ -20,6 +20,6 @@
  set -e
  cd $BASEDIR/$BUILD_DIR
diff --git a/debian/patches/0111_use_full_config_dirs.patch b/debian/patches/0111_use_full_config_dirs.patch
index 2a5ac61..576e1c7 100644
--- a/debian/patches/0111_use_full_config_dirs.patch
+++ b/debian/patches/0111_use_full_config_dirs.patch
@@ -2,9 +2,9 @@ Description: use full config include path
  This patch makes sure that the config files are not dependent on local
  directory structure.
 Author: Sascha Steinbiss <sascha at steinbiss.name>
---- a/src/spades_pipeline/spades_logic.py
-+++ b/src/spades_pipeline/spades_logic.py
-@@ -135,8 +135,18 @@
+--- spades.orig/src/spades_pipeline/spades_logic.py
++++ spades/src/spades_pipeline/spades_logic.py
+@@ -138,8 +138,18 @@
          dir_util.copy_tree(os.path.join(configs_dir, "debruijn"), dst_configs, preserve_times=False)
          # removing template configs
          for root, dirs, files in os.walk(dst_configs):
@@ -23,7 +23,7 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
                  if cfg_file.endswith('.info.template'):
                      if os.path.isfile(cfg_file.split('.template')[0]):
                          os.remove(cfg_file)
-@@ -195,6 +205,18 @@
+@@ -198,6 +208,18 @@
      dir_util.copy_tree(os.path.join(configs_dir, "debruijn"), dst_configs, preserve_times=False)
      # removing template configs
      for root, dirs, files in os.walk(dst_configs):
@@ -42,8 +42,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
          for cfg_file in files:
              cfg_file = os.path.join(root, cfg_file)
              if cfg_file.endswith('.info.template'):
---- a/src/spades_pipeline/corrector_logic.py
-+++ b/src/spades_pipeline/corrector_logic.py
+--- spades.orig/src/spades_pipeline/corrector_logic.py
++++ spades/src/spades_pipeline/corrector_logic.py
 @@ -51,6 +51,18 @@
      cfg_file_name = os.path.join(dst_configs, "corrector.info")
      # removing template configs
@@ -63,8 +63,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
          for cfg_file in files:
              cfg_file = os.path.join(root, cfg_file)
              if cfg_file.endswith('.template'):
---- a/src/spades_pipeline/hammer_logic.py
-+++ b/src/spades_pipeline/hammer_logic.py
+--- spades.orig/src/spades_pipeline/hammer_logic.py
++++ spades/src/spades_pipeline/hammer_logic.py
 @@ -111,6 +111,18 @@
          cfg_file_name = os.path.join(dst_configs, "config.info")
      # removing template configs
diff --git a/debian/patches/0112_spelling.patch b/debian/patches/0112_spelling.patch
index 893346c..cc6d83d 100644
--- a/debian/patches/0112_spelling.patch
+++ b/debian/patches/0112_spelling.patch
@@ -1,7 +1,7 @@
 Description: minor spelling fixes
 Author: Sascha Steinbiss <sascha at steinbiss.name>
---- a/src/dipspades/polymorphic_bulge_remover/bulge_splitter.hpp
-+++ b/src/dipspades/polymorphic_bulge_remover/bulge_splitter.hpp
+--- spades.orig/src/dipspades/polymorphic_bulge_remover/bulge_splitter.hpp
++++ spades/src/dipspades/polymorphic_bulge_remover/bulge_splitter.hpp
 @@ -260,7 +260,7 @@
  		SplitOppositeEdge(split_res, split_paths.second, split_partlens.second);
  
@@ -40,8 +40,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
  			TRACE("1st new bulge side - " << SimplePathWithVerticesToString(graph_, split_res.path1()));
  			TRACE("2nd new bulge side - " << SimplePathWithVerticesToString(graph_, split_res.path2()));
  			return shared_ptr<BaseBulge>(new Bulge(graph_, graph_.k(), split_res.path1(), split_res.path2()));
---- a/src/dipspades/polymorphic_bulge_remover/bulge_gluer.hpp
-+++ b/src/dipspades/polymorphic_bulge_remover/bulge_gluer.hpp
+--- spades.orig/src/dipspades/polymorphic_bulge_remover/bulge_gluer.hpp
++++ spades/src/dipspades/polymorphic_bulge_remover/bulge_gluer.hpp
 @@ -74,7 +74,7 @@
  		auto splitted_bulge = splitter_.SplitBulge(directed_bulge, glue_def_res);
  
@@ -51,8 +51,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
  			GlueSplittedBulge(splitted_bulge);
  			return true;
  		}
---- a/src/debruijn/pacbio/pac_index.hpp
-+++ b/src/debruijn/pacbio/pac_index.hpp
+--- spades.orig/src/debruijn/pacbio/pac_index.hpp
++++ spades/src/debruijn/pacbio/pac_index.hpp
 @@ -534,7 +534,7 @@
                              || !IsConsistent(s, *(iter->second),
                                               *(next_iter->second))) {
@@ -62,8 +62,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
                              DEBUG("on "<< iter->second->str(g_));
  			    DEBUG("and " << next_iter->second->str(g_));
                          }
---- a/src/dipspades/kmer_gluing/equal_sequence_gluer.hpp
-+++ b/src/dipspades/kmer_gluing/equal_sequence_gluer.hpp
+--- spades.orig/src/dipspades/kmer_gluing/equal_sequence_gluer.hpp
++++ spades/src/dipspades/kmer_gluing/equal_sequence_gluer.hpp
 @@ -74,9 +74,9 @@
  				pos2 = graph_.length(edge1) - tmp - 1;
  			}
diff --git a/debian/patches/0113_adjust_paths.patch b/debian/patches/0113_adjust_paths.patch
index 280e62e..ea29a51 100644
--- a/debian/patches/0113_adjust_paths.patch
+++ b/debian/patches/0113_adjust_paths.patch
@@ -2,8 +2,8 @@ Description: adjust runtime paths
  Debian stores components od SPAdes in different places than expected by
  upstream. This patch makes it look in the right locations.
 Author: Sascha Steinbiss <sascha at steinbiss.name>
---- a/spades_init.py
-+++ b/spades_init.py
+--- spades.orig/spades_init.py
++++ spades/spades_init.py
 @@ -25,7 +25,12 @@
      global ext_python_modules_home
  
@@ -18,8 +18,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
          install_prefix = os.path.dirname(spades_home)
          bin_home = os.path.join(install_prefix, 'bin')
          spades_home = os.path.join(install_prefix, 'share', 'spades')
---- a/truspades.py
-+++ b/truspades.py
+--- spades.orig/truspades.py
++++ spades/truspades.py
 @@ -11,8 +11,14 @@
  import sys
  import spades_init
diff --git a/debian/patches/0114_use_debian_provided_libs.patch b/debian/patches/0114_use_debian_provided_libs.patch
index 234dd47..c10a135 100644
--- a/debian/patches/0114_use_debian_provided_libs.patch
+++ b/debian/patches/0114_use_debian_provided_libs.patch
@@ -8,8 +8,8 @@ Description: use Debian-packaged jemalloc library
  does not report the 'stats.cactive_max' mallctl stat anymore.
  Hence to avoid a NULL dereference the max rss value is logged.
 Author: Sascha Steinbiss <sascha at steinbiss.name>
---- a/src/cmake/includes.cmake
-+++ b/src/cmake/includes.cmake
+--- spades.orig/src/cmake/includes.cmake
++++ spades/src/cmake/includes.cmake
 @@ -3,6 +3,8 @@
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
@@ -19,8 +19,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
  include_directories(${SPADES_MAIN_INCLUDE_DIR} ${SPADES_BUILT_INCLUDE_DIR})
  include_directories(SYSTEM "${EXT_DIR}/include")
  include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}")
---- a/src/cmake/flags.cmake
-+++ b/src/cmake/flags.cmake
+--- spades.orig/src/cmake/flags.cmake
++++ spades/src/cmake/flags.cmake
 @@ -53,3 +53,5 @@
  if (SPADES_USE_TCMALLOC)
    add_compile_options(-fno-omit-frame-pointer)
@@ -28,8 +28,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
 +
 +add_definitions(-DJEMALLOC_NO_DEMANGLE)
 \ No newline at end of file
---- a/src/io/logger_impl.cpp
-+++ b/src/io/logger_impl.cpp
+--- spades.orig/src/io/logger_impl.cpp
++++ spades/src/io/logger_impl.cpp
 @@ -13,6 +13,7 @@
  #include <vector>
  
@@ -58,8 +58,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
  }
  #else
  void logger::log(level desired_level, const char* file, size_t line_num, const char* source, const char* msg) {
---- a/src/include/memory_limit.hpp
-+++ b/src/include/memory_limit.hpp
+--- spades.orig/src/include/memory_limit.hpp
++++ spades/src/include/memory_limit.hpp
 @@ -18,6 +18,7 @@
  #include <sys/resource.h>
  
@@ -68,8 +68,8 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
  
  #ifdef SPADES_USE_JEMALLOC
  # include <jemalloc/jemalloc.h>
---- a/ext/src/CMakeLists.txt
-+++ b/ext/src/CMakeLists.txt
+--- spades.orig/ext/src/CMakeLists.txt
++++ spades/ext/src/CMakeLists.txt
 @@ -1,6 +1,5 @@
  # -*- cmake -*-
  
diff --git a/debian/patches/series b/debian/patches/series
index 9f945d8..a912a0b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
-0001_use_debian_packaged_python-yaml.patch
 0002_use_debian_packaged_python-joblib.patch
 0003_accept-system-bwa.patch
 0101_cmake_ignore_removed_python-yaml.patch
diff --git a/debian/rules b/debian/rules
index e70593c..3a6b0c7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -38,6 +38,11 @@ override_dh_auto_configure:
 
 override_dh_auto_build:
 	PREFIX=$(TMPDIR) ./spades_compile.sh
+# Use Debian-packaged yaml module
+	find $(TMPDIR) \
+	-type f \
+	-print0 \
+	-exec sed -i 's/pyyaml[2|3]/yaml/' {} +
 
 override_dh_installman:
 	mkdir -p $(mandir)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/spades.git



More information about the debian-med-commit mailing list