[med-svn] r16040 - in trunk/packages/spades/trunk/debian: . bin patches

Andreas Tille tille at moszumanska.debian.org
Fri Feb 14 10:05:21 UTC 2014


Author: tille
Date: 2014-02-14 10:05:21 +0000 (Fri, 14 Feb 2014)
New Revision: 16040

Added:
   trunk/packages/spades/trunk/debian/patches/
   trunk/packages/spades/trunk/debian/patches/adapt_to_debian_pathes.patch
   trunk/packages/spades/trunk/debian/patches/do_not_install_third_party_libs.patch
   trunk/packages/spades/trunk/debian/patches/series
   trunk/packages/spades/trunk/debian/patches/use_debian_packaged_python-yaml.patch
Modified:
   trunk/packages/spades/trunk/debian/bin/spades
   trunk/packages/spades/trunk/debian/control
   trunk/packages/spades/trunk/debian/links
   trunk/packages/spades/trunk/debian/rules
Log:
Do not install code copies of python-yaml and python-joblib and rather use Debian packaged code


Modified: trunk/packages/spades/trunk/debian/bin/spades
===================================================================
--- trunk/packages/spades/trunk/debian/bin/spades	2014-02-14 09:56:55 UTC (rev 16039)
+++ trunk/packages/spades/trunk/debian/bin/spades	2014-02-14 10:05:21 UTC (rev 16040)
@@ -1,5 +1,6 @@
 #!/bin/sh
 SPADESDIR=/usr/lib/spades/bin
+# SPADESSHARE=/usr/share/spades
 exename=`basename $0`
 PATH=$SPADESDIR:$PATH
 $SPADESDIR/${exename}.py $@

Modified: trunk/packages/spades/trunk/debian/control
===================================================================
--- trunk/packages/spades/trunk/debian/control	2014-02-14 09:56:55 UTC (rev 16039)
+++ trunk/packages/spades/trunk/debian/control	2014-02-14 10:05:21 UTC (rev 16040)
@@ -5,6 +5,7 @@
 Priority: optional
 Build-Depends: debhelper (>= 9),
                cmake,
+               python-all-dev,
                zlib1g-dev,
                lynx
 Standards-Version: 3.9.5
@@ -16,7 +17,9 @@
 Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends},
-         python
+         python,
+         python-joblib,
+         python-yaml
 Description: genome assembler for single-cell and isolates data sets
  The SPAdes – St. Petersburg genome assembler is intended for both
  standard isolates and single-cell MDA bacteria assemblies.  It works

Modified: trunk/packages/spades/trunk/debian/links
===================================================================
--- trunk/packages/spades/trunk/debian/links	2014-02-14 09:56:55 UTC (rev 16039)
+++ trunk/packages/spades/trunk/debian/links	2014-02-14 10:05:21 UTC (rev 16040)
@@ -1 +1,2 @@
-usr/bin/spades	usr/bin/dipspades
+usr/bin/spades					usr/bin/dipspades
+usr/lib/spades/share/spades/test_dataset	usr/share/doc/spades/examples

Added: trunk/packages/spades/trunk/debian/patches/adapt_to_debian_pathes.patch
===================================================================
--- trunk/packages/spades/trunk/debian/patches/adapt_to_debian_pathes.patch	                        (rev 0)
+++ trunk/packages/spades/trunk/debian/patches/adapt_to_debian_pathes.patch	2014-02-14 10:05:21 UTC (rev 16040)
@@ -0,0 +1,17 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Changed: Wed, 05 Feb 2014 15:12:36 +0100
+Description: There is no point in installing the Python modules under .../src
+
+--- a/spades_init.py
++++ b/spades_init.py
+@@ -9,8 +9,8 @@ import sys
+ 
+ # developers configuration
+ spades_home = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
+-bin_home = os.path.join(spades_home, 'bin')
+-python_modules_home = os.path.join(spades_home, 'src')
++bin_home = os.path.join('/usr/lib/spades', 'bin')
++python_modules_home = spades_home
+ ext_python_modules_home = os.path.join(spades_home, 'ext', 'src', 'python_libs')
+ spades_version = ''
+ 

Added: 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	                        (rev 0)
+++ trunk/packages/spades/trunk/debian/patches/do_not_install_third_party_libs.patch	2014-02-14 10:05:21 UTC (rev 16040)
@@ -0,0 +1,12 @@
+--- a/ext/src/CMakeLists.txt
++++ b/ext/src/CMakeLists.txt
+@@ -2,9 +2,5 @@
+ 
+ add_subdirectory(jemalloc)
+ add_subdirectory(otkpp)
+-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)

Added: trunk/packages/spades/trunk/debian/patches/series
===================================================================
--- trunk/packages/spades/trunk/debian/patches/series	                        (rev 0)
+++ trunk/packages/spades/trunk/debian/patches/series	2014-02-14 10:05:21 UTC (rev 16040)
@@ -0,0 +1,3 @@
+do_not_install_third_party_libs.patch
+adapt_to_debian_pathes.patch
+use_debian_packaged_python-yaml.patch

Added: trunk/packages/spades/trunk/debian/patches/use_debian_packaged_python-yaml.patch
===================================================================
--- trunk/packages/spades/trunk/debian/patches/use_debian_packaged_python-yaml.patch	                        (rev 0)
+++ trunk/packages/spades/trunk/debian/patches/use_debian_packaged_python-yaml.patch	2014-02-14 10:05:21 UTC (rev 16040)
@@ -0,0 +1,93 @@
+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
+@@ -31,10 +31,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/corrector.py
++++ b/src/spades_pipeline/corrector.py
+@@ -1253,10 +1253,7 @@ def main(args, joblib_path, log=None):
+             tmp.append(os.path.getsize(contig_file))
+             pairs.append(tmp)
+     pairs.sort(key=lambda x: x[-1], reverse=True)
+-    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
+     Parallel(n_jobs=config["t"])(delayed(process_contig)(pair) for pair in pairs)
+ #        inserted += loc_ins
+ #        replaced += loc_rep
+--- a/src/spades_pipeline/hammer_logic.py
++++ b/src/spades_pipeline/hammer_logic.py
+@@ -36,10 +36,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:
+@@ -72,10 +69,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"] = process_cfg.process_spaces(cfg.dataset_yaml_filename)
+@@ -89,10 +83,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):
+@@ -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
+@@ -59,10 +59,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:

Modified: trunk/packages/spades/trunk/debian/rules
===================================================================
--- trunk/packages/spades/trunk/debian/rules	2014-02-14 09:56:55 UTC (rev 16039)
+++ trunk/packages/spades/trunk/debian/rules	2014-02-14 10:05:21 UTC (rev 16040)
@@ -2,42 +2,37 @@
 
 # DH_VERBOSE := 1
 
-# some helpful variables - uncomment them if needed
-# shamelessly stolen from http://jmtd.net/log/awk/
-#DEBVERS        := $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
-#VERSION        := $(shell echo '$(DEBVERS)' | sed -e 's/^[0-9]*://' -e 's/-.*//')
-#DEBFLAVOR      := $(shell dpkg-parsechangelog | awk '/^Distribution:/ {print $$2}')
-DEBPKGNAME     := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
-#DEBIAN_BRANCH  := $(shell awk 'BEGIN{FS="[= ]+"} /debian-branch/ {print $$2}' debian/gbp.conf)
-#GIT_TAG        := $(subst ~,_,$(VERSION))
+DEBPKGNAME := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
+LIBDIR     := debian/$(DEBPKGNAME)/usr/lib/$(DEBPKGNAME)
+SHAREDIR   := debian/$(DEBPKGNAME)/usr/share/$(DEBPKGNAME)
 
-# alternatively to manually set those variables you can
-#  include /usr/share/cdbs/1/rules/buildvars.mk
-# and use what is set there.  Any hint whether dh might set variables in
-# a similar manner are welcome.
-
 PREFIX:=/usr
 BUILD_DIR:=build_spades
 
 %:
-	dh $@ --sourcedirectory=src --buildsystem=cmake
+	dh $@  --with python2 --sourcedirectory=src --buildsystem=cmake
 
 override_dh_install:
 	# move those binaries away from /usr/bin that do not need to be called explicitly
-	mkdir -p debian/$(DEBPKGNAME)/usr/lib/$(DEBPKGNAME)
-	mv debian/$(DEBPKGNAME)/usr/bin debian/$(DEBPKGNAME)/usr/lib/$(DEBPKGNAME)
-	mkdir -p debian/$(DEBPKGNAME)/usr/lib/$(DEBPKGNAME)/share
-	mv debian/$(DEBPKGNAME)/usr/share/$(DEBPKGNAME) debian/$(DEBPKGNAME)/usr/lib/$(DEBPKGNAME)/share
+	mkdir -p $(LIBDIR)
+	mv debian/$(DEBPKGNAME)/usr/bin $(LIBDIR)
+	#mkdir -p $(LIBDIR)/share
+	#mv $(SHAREDIR) $(LIBDIR)/share
+	for pyfile in `ls $(LIBDIR)/bin/*.py` ; do \
+	    mv $$pyfile $(SHAREDIR) ; \
+	    ln -s ../../../share/$(DEBPKGNAME)/`basename $$pyfile` $(LIBDIR)/bin/`basename $$pyfile` ; \
+	done
+	touch $(SHAREDIR)/spades_pipeline/__init__.py
 	# install wrapper
 	cp -a debian/bin debian/$(DEBPKGNAME)/usr/
-	# delete duplocate of license
+	# delete duplicate of license
 	find debian -type f -name GPLv2.txt -delete
 	find debian -type f -name LICENSE -delete
 
 override_dh_installdocs:
 	dh_installdocs
 	# move documentation
-	mv debian/$(DEBPKGNAME)/usr/lib/$(DEBPKGNAME)/share/$(DEBPKGNAME)/*.html debian/$(DEBPKGNAME)/usr/share/doc/$(DEBPKGNAME)
+	find debian/$(DEBPKGNAME)/usr -type f -name "*.html" -exec mv \{\} debian/$(DEBPKGNAME)/usr/share/doc/$(DEBPKGNAME) \;
 
 override_dh_installchangelogs:
 	lynx -dump changelog.html > changelog




More information about the debian-med-commit mailing list