Codebase list ctdconverter / 1b10188
adjust package structure, add test Michael R. Crusoe 6 years ago
4 changed file(s) with 113 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
0 ctdconverter.egg-info/
00 From: Michael R. Crusoe <michael.crusoe@gmail.com>
11 Subject: Add setup.py
22 Forwarded: https://github.com/WorkflowConversion/CTDConverter/pull/40
3 --- ctdconverter.orig/common/utils.py
4 +++ ctdconverter/common/utils.py
5 @@ -7,7 +7,7 @@
6 from string import strip
7 from logger import info, error, warning
8
9 -from common.exceptions import ApplicationException
10 +from .exceptions import ApplicationException
11 from CTDopts.CTDopts import CTDModel, ParameterGroup
12
13
314 --- ctdconverter.orig/convert.py
415 +++ ctdconverter/convert.py
5 @@ -8,7 +8,7 @@
6 from common.exceptions import ApplicationException, ModelError
16 @@ -1,14 +1,14 @@
17 import os
18 import sys
19 import traceback
20 -import common.utils as utils
21 +import .common.utils as utils
22
23 from argparse import ArgumentParser
24 from argparse import RawDescriptionHelpFormatter
25 -from common.exceptions import ApplicationException, ModelError
26 +from . import common.exceptions as exceptions
727
828 __all__ = []
929 -__version__ = 2.0
1131 __date__ = '2014-09-17'
1232 __updated__ = '2017-08-09'
1333
34 @@ -222,13 +222,13 @@
35 print("Interrupted...")
36 return 0
37
38 - except ApplicationException, e:
39 + except exceptions.ApplicationException, e:
40 traceback.print_exc()
41 utils.error("CTDConverter could not complete the requested operation.", 0)
42 utils.error("Reason: " + e.msg, 0)
43 return 1
44
45 - except ModelError, e:
46 + except exceptions.ModelError, e:
47 traceback.print_exc()
48 utils.error("There seems to be a problem with one of your input CTDs.", 0)
49 utils.error("Reason: " + e.msg, 0)
50 @@ -250,13 +250,13 @@
51 # if input is a single file, we expect output to be a file (and not a dir that already exists)
52 if len(args.input_files) == 1:
53 if os.path.isdir(args.output_destination):
54 - raise ApplicationException("If a single input file is provided, output (%s) is expected to be a file "
55 + raise exceptions.ApplicationException("If a single input file is provided, output (%s) is expected to be a file "
56 "and not a folder.\n" % args.output_destination)
57
58 # if input is a list of files, we expect output to be a folder
59 if len(args.input_files) > 1:
60 if not os.path.isdir(args.output_destination):
61 - raise ApplicationException("If several input files are provided, output (%s) is expected to be an "
62 + raise exceptions.ApplicationException("If several input files are provided, output (%s) is expected to be an "
63 "existing directory.\n" % args.output_destination)
64
65 # check that the provided input files, if provided, contain a valid file path
1466 @@ -269,4 +269,4 @@
1567
1668
1870 - sys.exit(main())
1971 \ No newline at end of file
2072 + sys.exit(main())
73 --- ctdconverter.orig/cwl/converter.py
74 +++ ctdconverter/cwl/converter.py
75 @@ -12,7 +12,7 @@
76 import ruamel.yaml as yaml
77
78 from CTDopts.CTDopts import _InFile, _OutFile, ParameterGroup, _Choices, _NumericRange, _FileFormat, ModelError, _Null
79 -from common import utils, logger
80 +from ..common import utils, logger
81
82 # all cwl-related properties are defined here
83
84 --- ctdconverter.orig/galaxy/converter.py
85 +++ ctdconverter/galaxy/converter.py
86 @@ -8,8 +8,8 @@
87 from lxml import etree
88 from lxml.etree import SubElement, Element, ElementTree, ParseError, parse
89
90 -from common import utils, logger
91 -from common.exceptions import ApplicationException, InvalidModelException
92 +from ..common import utils, logger
93 +from ..common.exceptions import ApplicationException, InvalidModelException
94
95 from CTDopts.CTDopts import _InFile, _OutFile, ParameterGroup, _Choices, _NumericRange, _FileFormat, ModelError, _Null
96
97 --- /dev/null
98 +++ ctdconverter/__main__.py
99 @@ -0,0 +1,6 @@
100 +from __future__ import absolute_import
101 +import sys
102 +
103 +from . import convert
104 +
105 +sys.exit(convert.main())
21106 --- /dev/null
22107 +++ ctdconverter/setup.py
23 @@ -0,0 +1,170 @@
108 @@ -0,0 +1,167 @@
24109 +"""A setuptools based setup module.
25110 +
26111 +See:
77162 + # This is a one-line description or tagline of what your project does. This
78163 + # corresponds to the "Summary" metadata field:
79164 + # https://packaging.python.org/specifications/core-metadata/#summary
80 + description='Convert CTD files into Galaxy tool and CWL CommandLineTool files', # Required
165 + description='Convert CTD files into Galaxy tool and CWL CommandLineTool '
166 + 'files', # Required
81167 +
82168 + # This is an optional longer description of your project that represents
83169 + # the body of text which users will see when they visit PyPI.
87173 + #
88174 + # This field corresponds to the "Description" metadata field:
89175 + # https://packaging.python.org/specifications/core-metadata/#description-optional
90 + long_description=long_description, # Optional
176 + long_description=long_description,
91177 +
92178 + # This should be a valid link to your project's main homepage.
93179 + #
94180 + # This field corresponds to the "Home-Page" metadata field:
95181 + # https://packaging.python.org/specifications/core-metadata/#home-page-optional
96 + url='https://github.com/WorkflowConversion/CTDConverter', # Optional
182 + url='https://github.com/WorkflowConversion/CTDConverter',
97183 +
98184 + # This should be your name or the name of the organization which owns the
99185 + # project.
100 + author='The WorkflowConversion team', # Optional
186 + author='The WorkflowConversion team',
101187 +
102188 + # This should be a valid email address corresponding to the author listed
103189 + # above.
107193 + #
108194 + # For a list of valid classifiers, see
109195 + # https://pypi.python.org/pypi?%3Aaction=list_classifiers
110 + classifiers=[ # Optional
196 + classifiers=[
111197 + # How mature is this project? Common values are
112198 + # 3 - Alpha
113199 + # 4 - Beta
137223 + # Note that this is a string of words separated by whitespace, not a list.
138224 + keywords='CTD CWL CommonWL Galaxy Workflows WorkflowConversion', # Optional
139225 +
140 + # You can just specify package directories manually here if your project is
141 + # simple. Or you can use find_packages().
142 + #
143 + # Alternatively, if you just want to distribute a single Python file, use
144 + # the `py_modules` argument instead as follows, which will expect a file
145 + # called `my_module.py` to exist:
146 + #
147 + py_modules=["convert"],
148 + #
149 + packages=find_packages(exclude=['contrib', 'docs', 'tests']), # Required
226 + packages=['ctdconverter', 'ctdconverter.common', 'ctdconverter.galaxy',
227 + 'ctdconverter.cwl'], # Required
228 + package_dir={ 'ctdconverter': '.',
229 + 'ctdconverter.common': 'common',
230 + 'ctdconverter.galaxy': 'galaxy',
231 + 'ctdconverter.cwl': 'cwl'},
150232 +
151233 + # This field lists other packages that your project depends on to run.
152234 + # Any package you put here will be installed by pip when your project is
174256 + #
175257 + # If using Python 2.6 or earlier, then these have to be included in
176258 + # MANIFEST.in as well.
177 + package_data={ # Optional
259 + package_data={
178260 + 'ctdconverter': ['galaxy/macros.xml'],
179261 + },
180262 +
187269 + # executes the function `main` from this package when invoked:
188270 + entry_points={ # Optional
189271 + 'console_scripts': [
190 + 'CTDConverter=convert:main',
272 + 'CTDConverter=ctdconverter',
191273 + ],
192274 + },
193275 +)
11 Subject: Upgrade deprecated using of string.strip()
22 --- ctdconverter.orig/common/utils.py
33 +++ ctdconverter/common/utils.py
4 @@ -4,8 +4,7 @@
4 @@ -4,7 +4,6 @@
55 import os
66
77 from lxml import etree
88 -from string import strip
9 -from logger import info, error, warning
10 +from logger import info, error, warning
9 from logger import info, error, warning
1110
12 from common.exceptions import ApplicationException
13 from CTDopts.CTDopts import CTDModel, ParameterGroup
11 from .exceptions import ApplicationException
1412 @@ -73,9 +72,9 @@
1513 if member_value is not None:
1614 if isinstance(member_value, list):
2321
2422 for path_to_check in paths_to_check:
2523 validate_path_exists(path_to_check)
26
22 # DH_VERBOSE := 1
33 export LC_ALL=C.UTF-8
44 export PYBUILD_NAME = ctdconverter
5 export PYBUILD_SYSTEM = distutils
56
67 include /usr/share/dpkg/default.mk
78 # this provides:
2930
3031 override_dh_installman: debian/CTDConverter.1
3132 dh_installman
33
34 override_dh_auto_test:
35 dh_auto_install
36 PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="export \
37 PYTHONPATH={build_dir} && {interpreter} -m \
38 ctdconverter.convert --help" dh_auto_test