Permalink
Browse files

robot runner script: initial implementation. Needs still at least docs.

  • Loading branch information...
1 parent 1262b5c commit ec2dae99bf9bf9ed08ecf8cdd669ec792ea8c493 @jussimalinen jussimalinen committed Nov 16, 2015
Showing with 40 additions and 5 deletions.
  1. +1 −1 MANIFEST.in
  2. +31 −4 setup.py
  3. +6 −0 src/bin/robot
  4. +2 −0 src/bin/robot.bat
View
@@ -1,4 +1,4 @@
-include src/bin/*ybot src/bin/*rebot src/bin/*.bat
+include src/bin/*bot src/bin/*.bat
include src/robot/htmldata/*/*.html src/robot/htmldata/*/*.js src/robot/htmldata/*/*.css
include AUTHORS.txt BUILD.rst CONTRIBUTING.rst COPYRIGHT.txt INSTALL.rst LICENSE.txt README.rst MANIFEST.in tasks.py
prune src/robot/htmldata/testdata
View
@@ -4,6 +4,7 @@
import os
from os.path import abspath, join, dirname
from distutils.core import setup
+from distutils.command.install_scripts import install_scripts
try:
import setuptools # use setuptools when available
@@ -52,19 +53,44 @@
PACKAGE_DATA = [join('htmldata', directory, pattern)
for directory in ('rebot', 'libdoc', 'testdoc', 'lib', 'common')
for pattern in ('*.html', '*.css', '*.js')]
+WINDOWS = os.sep == '\\'
if sys.platform.startswith('java'):
- SCRIPTS = ['jybot', 'jyrebot']
+ SCRIPTS = ['jybot', 'jyrebot', 'robot', 'rebot']
+ INTERPRETER = 'jython'
elif sys.platform == 'cli':
- SCRIPTS = ['ipybot', 'ipyrebot']
+ SCRIPTS = ['ipybot', 'ipyrebot', 'robot', 'rebot']
+ INTERPRETER = 'ipy'
else:
- SCRIPTS = ['pybot', 'rebot']
+ SCRIPTS = ['pybot', 'rebot', 'robot']
+ INTERPRETER = 'python'
SCRIPTS = [join('src', 'bin', s) for s in SCRIPTS]
-if os.sep == '\\':
+if WINDOWS:
SCRIPTS = [s+'.bat' for s in SCRIPTS]
if 'bdist_wininst' in sys.argv:
SCRIPTS.append('robot_postinstall.py')
LONG_DESCRIPTION = WINDOWS_DESCRIPTION
+
+def replace_interpreter(filepath):
+ with open(filepath, 'r') as input:
+ replaced = input.read().replace('python', INTERPRETER)
+ with open(filepath, 'w') as output:
+ output.write(replaced)
+
+
+class install_scripts_and_replace_bat_interpreter(install_scripts):
+ def run(self):
+ install_scripts.run(self)
+ if not WINDOWS or INTERPRETER == 'python':
+ return
+ print("replacing interpreter in robot.bat and rebot.bat.")
+ for filepath in self.get_outputs():
+ if filepath.endswith('robot.bat'):
+ replace_interpreter(filepath)
+ if filepath.endswith('rebot.bat'):
+ replace_interpreter(filepath)
+
+
setup(
name = 'robotframework',
version = VERSION,
@@ -78,6 +104,7 @@
keywords = KEYWORDS,
platforms = 'any',
classifiers = CLASSIFIERS,
+ cmdclass = {'install_scripts': install_scripts_and_replace_bat_interpreter},
package_dir = {'': 'src'},
package_data = {'robot': PACKAGE_DATA},
packages = PACKAGES,
View
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+import sys
+from robot import run_cli
+
+run_cli(sys.argv[1:])
View
@@ -0,0 +1,2 @@
+@echo off
+python -m robot.run %*

0 comments on commit ec2dae9

Please sign in to comment.