0 | 0 |
From: Michael R. Crusoe <michael.crusoe@gmail.com>
|
1 | 1 |
Subject: Add setup.py
|
2 | 2 |
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 |
|
3 | 14 |
--- ctdconverter.orig/convert.py
|
4 | 15 |
+++ 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
|
7 | 27 |
|
8 | 28 |
__all__ = []
|
9 | 29 |
-__version__ = 2.0
|
|
11 | 31 |
__date__ = '2014-09-17'
|
12 | 32 |
__updated__ = '2017-08-09'
|
13 | 33 |
|
|
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
|
14 | 66 |
@@ -269,4 +269,4 @@
|
15 | 67 |
|
16 | 68 |
|
|
18 | 70 |
- sys.exit(main())
|
19 | 71 |
\ No newline at end of file
|
20 | 72 |
+ 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())
|
21 | 106 |
--- /dev/null
|
22 | 107 |
+++ ctdconverter/setup.py
|
23 | |
@@ -0,0 +1,170 @@
|
|
108 |
@@ -0,0 +1,167 @@
|
24 | 109 |
+"""A setuptools based setup module.
|
25 | 110 |
+
|
26 | 111 |
+See:
|
|
77 | 162 |
+ # This is a one-line description or tagline of what your project does. This
|
78 | 163 |
+ # corresponds to the "Summary" metadata field:
|
79 | 164 |
+ # 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
|
81 | 167 |
+
|
82 | 168 |
+ # This is an optional longer description of your project that represents
|
83 | 169 |
+ # the body of text which users will see when they visit PyPI.
|
|
87 | 173 |
+ #
|
88 | 174 |
+ # This field corresponds to the "Description" metadata field:
|
89 | 175 |
+ # https://packaging.python.org/specifications/core-metadata/#description-optional
|
90 | |
+ long_description=long_description, # Optional
|
|
176 |
+ long_description=long_description,
|
91 | 177 |
+
|
92 | 178 |
+ # This should be a valid link to your project's main homepage.
|
93 | 179 |
+ #
|
94 | 180 |
+ # This field corresponds to the "Home-Page" metadata field:
|
95 | 181 |
+ # 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',
|
97 | 183 |
+
|
98 | 184 |
+ # This should be your name or the name of the organization which owns the
|
99 | 185 |
+ # project.
|
100 | |
+ author='The WorkflowConversion team', # Optional
|
|
186 |
+ author='The WorkflowConversion team',
|
101 | 187 |
+
|
102 | 188 |
+ # This should be a valid email address corresponding to the author listed
|
103 | 189 |
+ # above.
|
|
107 | 193 |
+ #
|
108 | 194 |
+ # For a list of valid classifiers, see
|
109 | 195 |
+ # https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
110 | |
+ classifiers=[ # Optional
|
|
196 |
+ classifiers=[
|
111 | 197 |
+ # How mature is this project? Common values are
|
112 | 198 |
+ # 3 - Alpha
|
113 | 199 |
+ # 4 - Beta
|
|
137 | 223 |
+ # Note that this is a string of words separated by whitespace, not a list.
|
138 | 224 |
+ keywords='CTD CWL CommonWL Galaxy Workflows WorkflowConversion', # Optional
|
139 | 225 |
+
|
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'},
|
150 | 232 |
+
|
151 | 233 |
+ # This field lists other packages that your project depends on to run.
|
152 | 234 |
+ # Any package you put here will be installed by pip when your project is
|
|
174 | 256 |
+ #
|
175 | 257 |
+ # If using Python 2.6 or earlier, then these have to be included in
|
176 | 258 |
+ # MANIFEST.in as well.
|
177 | |
+ package_data={ # Optional
|
|
259 |
+ package_data={
|
178 | 260 |
+ 'ctdconverter': ['galaxy/macros.xml'],
|
179 | 261 |
+ },
|
180 | 262 |
+
|
|
187 | 269 |
+ # executes the function `main` from this package when invoked:
|
188 | 270 |
+ entry_points={ # Optional
|
189 | 271 |
+ 'console_scripts': [
|
190 | |
+ 'CTDConverter=convert:main',
|
|
272 |
+ 'CTDConverter=ctdconverter',
|
191 | 273 |
+ ],
|
192 | 274 |
+ },
|
193 | 275 |
+)
|