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