File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,11 +124,17 @@ def job_to_html(job):
124124 return body_text .encode ()
125125
126126
127- def _main ( ):
127+ def main ( argv = None ):
128128 """
129129 Parse the command line inputs and start web monitor.
130+
131+ :param argv: List of arguments, as if specified on the command-line.
132+ If None, ``sys.argv`` is used instead.
133+ :type argv: list of str
130134 """
131135 # Get command line arguments
136+ if argv is None :
137+ argv = sys .argv
132138 parser = argparse .ArgumentParser (description = "Provides a web interface to \
133139 0MQ job monitor." )
134140 parser .add_argument ('module_dir' ,
@@ -138,7 +144,7 @@ def _main():
138144 parser .add_argument ('-p' , '--port' ,
139145 help = 'Port for server to listen on.' , type = int ,
140146 default = 8076 )
141- args = parser .parse_args ()
147+ args = parser .parse_args (argv )
142148
143149 # Make warnings from built-in warnings module get formatted more nicely
144150 logging .captureWarnings (True )
@@ -161,4 +167,4 @@ def _main():
161167
162168
163169if __name__ == "__main__" :
164- _main ()
170+ main ()
Original file line number Diff line number Diff line change 2525exec (compile (open ('gridmap/version.py' ).read (), 'gridmap/version.py' , 'exec' ))
2626# (we use the above instead of execfile for Python 3.x compatibility)
2727
28+
2829def readme ():
2930 with open ('README.rst' ) as f :
3031 return f .read ()
3132
3233
34+ def requirements ():
35+ with open ('requirements.txt' ) as f :
36+ reqs = f .read ().splitlines ()
37+ return reqs
38+
39+
3340setup (name = 'gridmap' ,
3441 version = __version__ ,
3542 description = ('Easily map Python functions onto a cluster using a ' +
@@ -41,8 +48,8 @@ def readme():
4148 author_email = 'dblanchard@ets.org' ,
4249 license = 'GPL' ,
4350 packages = ['gridmap' ],
44- install_requires = [ 'drmaa' , 'pyzmq' ] ,
45- scripts = [ 'scripts/ gridmap_web' ] ,
51+ install_requires = requirements () ,
52+ entry_points = { 'console_scripts' : [ ' gridmap_web = gridmap.web:main' ]} ,
4653 classifiers = ['Intended Audience :: Science/Research' ,
4754 'Intended Audience :: Developers' ,
4855 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)' ,
You can’t perform that action at this time.
0 commit comments