[med-svn] r18899 - trunk/packages/spades/trunk/debian/patches

Andreas Tille tille at moszumanska.debian.org
Tue Mar 3 20:03:50 UTC 2015


Author: tille
Date: 2015-03-03 20:03:50 +0000 (Tue, 03 Mar 2015)
New Revision: 18899

Added:
   trunk/packages/spades/trunk/debian/patches/0001_use_debian_packaged_python-yaml.patch
   trunk/packages/spades/trunk/debian/patches/0002_use_debian_packaged_python-joblib.patch
Removed:
   trunk/packages/spades/trunk/debian/patches/use_debian_packaged_python-yaml.patch
Modified:
   trunk/packages/spades/trunk/debian/patches/do_not_install_third_party_libs.patch
   trunk/packages/spades/trunk/debian/patches/series
Log:
Better organising of patches


Added: trunk/packages/spades/trunk/debian/patches/0001_use_debian_packaged_python-yaml.patch
===================================================================
--- trunk/packages/spades/trunk/debian/patches/0001_use_debian_packaged_python-yaml.patch	                        (rev 0)
+++ trunk/packages/spades/trunk/debian/patches/0001_use_debian_packaged_python-yaml.patch	2015-03-03 20:03:50 UTC (rev 18899)
@@ -0,0 +1,84 @@
+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/ext/src/CMakeLists.txt
++++ b/ext/src/CMakeLists.txt
+@@ -4,8 +4,6 @@ add_subdirectory(jemalloc)
+ add_subdirectory(nlopt)
+ add_subdirectory(python_libs/joblib2)
+ add_subdirectory(python_libs/joblib3)
+-add_subdirectory(python_libs/pyyaml2)
+-add_subdirectory(python_libs/pyyaml3)
+ add_subdirectory(yaml-cpp)
+ add_subdirectory(ConsensusCore)
+ add_subdirectory(bamtools)
+--- a/spades.py
++++ b/spades.py
+@@ -32,10 +32,13 @@ import hammer_logic
+ import spades_logic
+ import options_storage
+ addsitedir(ext_python_modules_home)
+-if sys.version.startswith('2.'):
++try:
++    if sys.version.startswith('2.'):
+     import pyyaml2 as pyyaml
+-elif sys.version.startswith('3.'):
++    elif sys.version.startswith('3.'):
+     import pyyaml3 as pyyaml
++except:
++    import yaml as pyyaml
+ 
+ def print_used_values(cfg, log):
+     def print_value(cfg, section, param, pretty_param="", margin="  "):
+--- a/src/spades_pipeline/hammer_logic.py
++++ b/src/spades_pipeline/hammer_logic.py
+@@ -73,10 +73,13 @@ def prepare_config_bh(filename, cfg, log
+ 
+ def prepare_config_ih(filename, cfg, ext_python_modules_home):
+     addsitedir(ext_python_modules_home)
++    try:
+     if sys.version.startswith('2.'):
+         import pyyaml2 as pyyaml
+     elif sys.version.startswith('3.'):
+         import pyyaml3 as pyyaml
++    except:
++        import yaml as pyyaml
+ 
+     data = pyyaml.load(open(filename, 'r'))
+     data["dataset"] = cfg.dataset_yaml_filename
+@@ -90,10 +93,13 @@ def prepare_config_ih(filename, cfg, ext
+ 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)
++    try:
+     if sys.version.startswith('2.'):
+         import pyyaml2 as pyyaml
+     elif sys.version.startswith('3.'):
+         import pyyaml3 as pyyaml
++    except:
++        import yaml as pyyaml
+     dst_configs = os.path.join(cfg.output_dir, "configs")
+     if os.path.exists(dst_configs):
+         shutil.rmtree(dst_configs)
+--- a/src/spades_pipeline/spades_logic.py
++++ b/src/spades_pipeline/spades_logic.py
+@@ -68,10 +68,13 @@ def get_read_length(output_dir, K, ext_p
+     max_read_length = 0
+     if os.path.isfile(est_params_filename):
+         addsitedir(ext_python_modules_home)
++        try:
+         if sys.version.startswith('2.'):
+             import pyyaml2 as pyyaml
+         elif sys.version.startswith('3.'):
+             import pyyaml3 as pyyaml
++        except:
++            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:

Added: trunk/packages/spades/trunk/debian/patches/0002_use_debian_packaged_python-joblib.patch
===================================================================
--- trunk/packages/spades/trunk/debian/patches/0002_use_debian_packaged_python-joblib.patch	                        (rev 0)
+++ trunk/packages/spades/trunk/debian/patches/0002_use_debian_packaged_python-joblib.patch	2015-03-03 20:03:50 UTC (rev 18899)
@@ -0,0 +1,69 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Changed: Tue, 03 Mar 2015 20:55:53 +0100
+Description: We are using Debian packaged python-joblib
+ 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/src/spades_pipeline/hammer_logic.py
++++ b/src/spades_pipeline/hammer_logic.py
+@@ -37,10 +37,13 @@ def compress_dataset_files(dataset_data,
+                 support.sys_call([pigz_path, '-f', '-7', '-p', str(max_threads), reads_file], log)
+         else:
+             addsitedir(ext_python_modules_home)
+-            if sys.version.startswith('2.'):
+-                from joblib2 import Parallel, delayed
+-            elif sys.version.startswith('3.'):
+-                from joblib3 import Parallel, delayed
++            try:
++                if sys.version.startswith('2.'):
++                    from joblib2 import Parallel, delayed
++                elif sys.version.startswith('3.'):
++                    from joblib3 import Parallel, delayed
++            except:
++                from joblib import Parallel, delayed
+             n_jobs = min(len(to_compress), max_threads)
+             outputs = Parallel(n_jobs=n_jobs)(delayed(support.sys_call)(['gzip', '-f', '-7', reads_file]) for reads_file in to_compress)
+             for output in outputs:
+@@ -148,4 +151,4 @@ def run_hammer(corrected_dataset_yaml_fi
+     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/lucigen_nxmate.py
++++ b/src/spades_pipeline/lucigen_nxmate.py
+@@ -36,12 +36,14 @@ except ImportError:
+     support.error("Can't process Lucigen NxMate reads! Python module regex is not installed!")
+ 
+ addsitedir(spades_init.ext_python_modules_home)
+-if sys.version.startswith('2.'):
+-    from joblib2 import Parallel, delayed
+-elif sys.version.startswith('3.'):
+-    from joblib3 import Parallel, delayed
++try:
++    if sys.version.startswith('2.'):
++        from joblib2 import Parallel, delayed
++    elif sys.version.startswith('3.'):
++        from joblib3 import Parallel, delayed
++except:
++    from joblib import Parallel, delayed
+ 
+-    
+ # CONSTANTS
+ READS_PER_THREAD = 25000
+ READS_PER_BATCH = READS_PER_THREAD * options_storage.threads  # e.g. 100000 for 4 threads
+--- a/ext/src/CMakeLists.txt
++++ b/ext/src/CMakeLists.txt
+@@ -2,8 +2,6 @@
+ 
+ add_subdirectory(jemalloc)
+ add_subdirectory(nlopt)
+-add_subdirectory(python_libs/joblib2)
+-add_subdirectory(python_libs/joblib3)
+ add_subdirectory(yaml-cpp)
+ add_subdirectory(ConsensusCore)
+ add_subdirectory(bamtools)

Modified: trunk/packages/spades/trunk/debian/patches/do_not_install_third_party_libs.patch
===================================================================
--- trunk/packages/spades/trunk/debian/patches/do_not_install_third_party_libs.patch	2015-03-03 12:32:31 UTC (rev 18898)
+++ trunk/packages/spades/trunk/debian/patches/do_not_install_third_party_libs.patch	2015-03-03 20:03:50 UTC (rev 18899)
@@ -6,14 +6,8 @@
 
 --- a/ext/src/CMakeLists.txt
 +++ b/ext/src/CMakeLists.txt
-@@ -2,11 +2,6 @@
- 
- add_subdirectory(jemalloc)
+@@ -4,5 +4,4 @@ add_subdirectory(jemalloc)
  add_subdirectory(nlopt)
--add_subdirectory(python_libs/joblib2)
--add_subdirectory(python_libs/joblib3)
--add_subdirectory(python_libs/pyyaml2)
--add_subdirectory(python_libs/pyyaml3)
  add_subdirectory(yaml-cpp)
  add_subdirectory(ConsensusCore)
 -add_subdirectory(bamtools)

Modified: trunk/packages/spades/trunk/debian/patches/series
===================================================================
--- trunk/packages/spades/trunk/debian/patches/series	2015-03-03 12:32:31 UTC (rev 18898)
+++ trunk/packages/spades/trunk/debian/patches/series	2015-03-03 20:03:50 UTC (rev 18899)
@@ -1,6 +1,7 @@
+0001_use_debian_packaged_python-yaml.patch
+0002_use_debian_packaged_python-joblib.patch
 do_not_install_third_party_libs.patch
 adapt_to_debian_pathes.patch
-use_debian_packaged_python-yaml.patch
 use-debian-packaged-bwa.patch
 # use-debian-packaged-samtools.patch
 # bamtools-cmake.patch

Deleted: trunk/packages/spades/trunk/debian/patches/use_debian_packaged_python-yaml.patch
===================================================================
--- trunk/packages/spades/trunk/debian/patches/use_debian_packaged_python-yaml.patch	2015-03-03 12:32:31 UTC (rev 18898)
+++ trunk/packages/spades/trunk/debian/patches/use_debian_packaged_python-yaml.patch	2015-03-03 20:03:50 UTC (rev 18899)
@@ -1,79 +0,0 @@
-Author: Andreas Tille <tille at debian.org>
-Last-Changed: Wed, 05 Feb 2014 15:12:36 +0100
-Description: We are using Debian packaged python-yaml and
- python-joblib.  Debian has its own way to distinguish Python versions
- and there is no point in doing this inside the code
-
---- a/spades.py
-+++ b/spades.py
-@@ -32,10 +32,7 @@ import hammer_logic
- 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
- 
- def print_used_values(cfg, log):
-     def print_value(cfg, section, param, pretty_param="", margin="  "):
---- a/src/spades_pipeline/hammer_logic.py
-+++ b/src/spades_pipeline/hammer_logic.py
-@@ -37,10 +37,7 @@ def compress_dataset_files(dataset_data,
-                 support.sys_call([pigz_path, '-f', '-7', '-p', str(max_threads), reads_file], log)
-         else:
-             addsitedir(ext_python_modules_home)
--            if sys.version.startswith('2.'):
--                from joblib2 import Parallel, delayed
--            elif sys.version.startswith('3.'):
--                from joblib3 import Parallel, delayed
-+            from joblib import Parallel, delayed
-             n_jobs = min(len(to_compress), max_threads)
-             outputs = Parallel(n_jobs=n_jobs)(delayed(support.sys_call)(['gzip', '-f', '-7', reads_file]) for reads_file in to_compress)
-             for output in outputs:
-@@ -73,10 +70,7 @@ def prepare_config_bh(filename, cfg, log
- 
- 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
-@@ -90,10 +84,7 @@ def prepare_config_ih(filename, cfg, ext
- 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)
-@@ -142,4 +133,4 @@ def run_hammer(corrected_dataset_yaml_fi
-     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
-@@ -68,10 +68,7 @@ def get_read_length(output_dir, K, ext_p
-     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:




More information about the debian-med-commit mailing list