File: python2to3.patch

package info (click to toggle)
snakemake 7.21.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 25,052 kB
  • sloc: python: 30,995; javascript: 1,290; makefile: 247; sh: 163; ansic: 57; lisp: 9
file content (97 lines) | stat: -rw-r--r-- 3,599 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Author: Steffen Moeller
Description: Tests have a series of invocations of the former python executable.
Forwarded: not needed since Debian-specific.

--- a/tests/test_github_issue627/Snakefile
+++ b/tests/test_github_issue627/Snakefile
@@ -2,7 +2,7 @@ rule:
     shell:
         """
         set +e
-        python -m snakemake --cores 1 -p --profile . -s Snakefile.internal
+        python3 -m snakemake --cores 1 -p --profile . -s Snakefile.internal
         RETVAL=$?
         set -e
 
--- a/tests/test_github_issue627/job.py
+++ b/tests/test_github_issue627/job.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 
 import time
 
--- a/tests/test_github_issue_14/pythonTest.py
+++ b/tests/test_github_issue_14/pythonTest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 import sys
 import os
 import local_script
--- a/tests/test_issue916/pythonTest.py
+++ b/tests/test_issue916/pythonTest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 import sys
 import os
 import local_script
--- a/tests/test_tibanna/README.md
+++ b/tests/test_tibanna/README.md
@@ -5,7 +5,7 @@ tibanna deploy_unicorn --usergroup=johan
 ```
 # run the following to do a test run
 pip install -U tibanna
-python cleanup.py  # first delete output files that are already on s3
+python3 cleanup.py  # first delete output files that are already on s3
 export TIBANNA_DEFAULT_STEP_FUNCTION_NAME=tibanna_unicorn_johannes
 snakemake --tibanna --use-conda --configfile=config.json --default-remote-prefix=snakemake-tibanna-test/1
 ```
--- a/snakemake/script.py
+++ b/snakemake/script.py
@@ -637,7 +637,7 @@ class PythonScript(ScriptBase):
 
     def _get_python_version(self):
         out = self._execute_cmd(
-            "python -c \"import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')\"",
+            "python3 -c \"import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')\"",
             read=True,
         )
         try:
@@ -651,7 +651,7 @@ class PythonScript(ScriptBase):
         py_exec = sys.executable
         if self.container_img is not None:
             # use python from image
-            py_exec = "python"
+            py_exec = "python3"
         elif self.conda_env is not None or self.env_modules is not None:
             if self._is_python_env():
                 py_version = self._get_python_version()
@@ -660,7 +660,7 @@ class PythonScript(ScriptBase):
                     if py_version >= MIN_PY_VERSION:
                         # Python version is new enough, make use of environment
                         # to execute script
-                        py_exec = "python"
+                        py_exec = "python3"
                     else:
                         logger.warning(
                             "Environment defines Python "
--- a/snakemake/unit_tests/templates/ruletest.py.jinja2
+++ b/snakemake/unit_tests/templates/ruletest.py.jinja2
@@ -26,7 +26,7 @@ def test_{{ ruletest.name }}():
 
         # Run the test job.
         sp.check_output([
-            "python",
+            "python3",
             "-m",
             "snakemake", 
             "{{ ruletest.target }}",
@@ -53,4 +53,4 @@ def test_{{ ruletest.name }}():
         # To modify this behavior, you can inherit from common.OutputChecker in here
         # and overwrite the method `compare_files(generated_file, expected_file), 
         # also see common.py.
-        common.OutputChecker(data_path, expected_path, workdir).check()
\ No newline at end of file
+        common.OutputChecker(data_path, expected_path, workdir).check()