Skip to content

Commit 5ff4511

Browse files
committed
Setting up python for CS CLI
Added content related to setting up python for CS CLI
1 parent 7ce4690 commit 5ff4511

File tree

8 files changed

+242
-7
lines changed

8 files changed

+242
-7
lines changed

cloudslang/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

cloudslang/cloudslang_content.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ Running Content Dependent on Java Actions
4141

4242
Some of the content is dependent on Java actions from the cs-actions repository.
4343
CloudSlang uses Maven to manage these dependencies. When executing an operation
44-
that declares a dependency, the required Maven project and all the resources
44+
that declares a dependency, the required Maven project and all the resources
4545
specified in its pom's ``dependencies`` will be resolved and downloaded (if
4646
necessary).
4747

4848
.. note::
4949

50-
Maven version used in the CLI, Builder and cs-actions is ``3.3.9`` with JRE version ``8u282-8.52.0.23``
50+
Maven version used in the CLI, Builder and cs-actions is ``3.3.9`` with JRE version ``8u282-8.52.0.23``.
5151
There might be some issues while building the Java Actions with
5252
other versions.
5353

cloudslang/cloudslang_dsl_reference.rst

+42-3
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,32 @@ cannot be named ``on_failure``.
18451845
are evaluated are ``SUCCESS`` and ``FAILURE``. Any other results will be
18461846
evaluated as ``SUCCESS``.
18471847

1848+
run_id
1849+
------
1850+
1851+
The ``run_id`` returns the run ID of the current execution.
1852+
1853+
**Example - assign a flow with run_id parameter**
1854+
1855+
.. code-block:: yaml
1856+
1857+
- namespace: run_id
1858+
flow:
1859+
name: run_id_usage
1860+
workflow:
1861+
- add_numbers:
1862+
do:
1863+
io.cloudslang.base.math.add_numbers:
1864+
- value1: 'integer1'
1865+
- value2: 'integer2'
1866+
- run_id: '${run_id}'
1867+
navigate:
1868+
- SUCCESS: SUCCESS
1869+
- FAILURE: on_failure
1870+
results:
1871+
- FAILURE
1872+
- SUCCESS
1873+
18481874
Flow Results
18491875
~~~~~~~~~~~~
18501876

@@ -1994,10 +2020,10 @@ modules:
19942020
Installing Packages into the python-lib Folder
19952021
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19962022

1997-
Prerequisites: Python 2.7 and pip.
2023+
Prerequisites: Python 3.8.7 and pip.
19982024

1999-
You can download Python (version 2.7) from `here <https://www.python.org/>`__.
2000-
Python 2.7.9 and later include pip by default. If you already have Python but
2025+
You can download Python (version 3.8.7) from `here <https://www.python.org/>`__.
2026+
that includes pip by default. If you already have Python but
20012027
don't have pip, see the pip
20022028
`documentation <https://pip.pypa.io/en/latest/installing.html>`__ for
20032029
installation instructions.
@@ -2434,6 +2460,19 @@ value associated with ``expression2``.
24342460
outputs:
24352461
- out1
24362462
2463+
.. _regex:
2464+
2465+
cs_regex(selection, regex, split_lines)
2466+
---------------------------------------
2467+
2468+
May appear in the value of an `input <#inputs>`__ and `expression <#expressions>`__.
2469+
2470+
**Example - usage of ``regex`` function in inputs**
2471+
2472+
.. code-block:: Python
2473+
2474+
2475+
24372476
.. _get:
24382477

24392478
get()

cloudslang/conf.py

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'cloudslang_doc'
21+
copyright = '2021, Narendra'
22+
author = 'Narendra'
23+
24+
# The full version, including alpha/beta/rc tags
25+
release = '2.0'
26+
27+
28+
# -- General configuration ---------------------------------------------------
29+
30+
# Add any Sphinx extension module names here, as strings. They can be
31+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32+
# ones.
33+
extensions = [
34+
]
35+
36+
# Add any paths that contain templates here, relative to this directory.
37+
templates_path = ['_templates']
38+
39+
# List of patterns, relative to source directory, that match files and
40+
# directories to ignore when looking for source files.
41+
# This pattern also affects html_static_path and html_extra_path.
42+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
43+
44+
45+
# -- Options for HTML output -------------------------------------------------
46+
47+
# The theme to use for HTML and HTML Help pages. See the documentation for
48+
# a list of builtin themes.
49+
#
50+
html_theme = 'alabaster'
51+
52+
# Add any paths that contain custom static files (such as style sheets) here,
53+
# relative to this directory. They are copied after the builtin static files,
54+
# so a file named "default.css" will overwrite the builtin "default.css".
55+
html_static_path = ['_static']

cloudslang/index.rst

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. cloudslang_doc documentation master file, created by
2+
sphinx-quickstart on Mon Jun 14 19:35:22 2021.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to cloudslang_doc's documentation!
7+
==========================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
14+
15+
Indices and tables
16+
==================
17+
18+
* :ref:`genindex`
19+
* :ref:`modindex`
20+
* :ref:`search`

cloudslang/make.bat

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

overview/get_started.rst

+33
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,39 @@ Download, Unzip and Run
2020
- The CLI will run the ready-made ``print_text`` operation that will
2121
print the value passed to the variable ``text`` to the screen.
2222

23+
Set up python for CloudSlang cli
24+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25+
26+
To use an external python in cloudslang-cli, set the ``use.jython.expressions``
27+
property to ``false`` in ``cslang-cli/configuration/cslang.properties``.
28+
29+
.. Important::
30+
31+
By default, the property ``use.jython.expressions=true`` is set to ``true``
32+
pointing to use Jython.
33+
34+
#. Unzip the downloaded python 3.8.7 package to any directory. Notice the python-3.8.7 folder after unzipping.
35+
#. Navigate to **cslang-cli/configuration** and open the **cslang.properties** file using any text editor.
36+
#. Specify a property ``python.path`` to point it to the following locations based on your Operating System:
37+
38+
* Windows: **<unzipped_location>/python-3.8.7**
39+
40+
* Linux: **<unzipped_location>/python-3.8.7/bin**
41+
42+
#. Additionally for Linux environment, perform the following steps to grant permissions:
43+
44+
a. Open the terminal shell at **/python-3.8.7/bin** folder, and then run the following command:
45+
46+
.. code:: bash
47+
48+
ln -sf python3 python
49+
50+
b. Navigate back to **/python-3.8.7** folder, and then run the following command. The permission to access the folder is granted.
51+
52+
.. code:: bash
53+
54+
chmod -R 755 bin
55+
2356
Docker
2457
======
2558

tutorial/15_lesson.rst

+35-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Get Started
1212

1313
In this lesson we'll be installing a 3rd party Python package. In order to do so
1414
you'll need to have Python and pip installed on your machine. You can download
15-
Python (version 2.7) from `here <https://www.python.org/>`__. Python 2.7.9 and
16-
later include pip by default. If you already have Python but don't have pip
15+
Python (version 3.8.x) from `here <https://www.python.org/>`__ which includes pip
16+
by default. If you already have Python but don't have pip
1717
installed on your machine, see the pip
1818
`documentation <https://pip.pypa.io/en/latest/installing.html>`__ for
1919
installation instructions.
@@ -48,6 +48,39 @@ like this (other folders omitted for simplicity):
4848
And finally, we'll need a new file, **fancy_text.sl** in the
4949
**tutorials/hiring** folder, to house a new operation.
5050

51+
Set up python for CloudSlang cli
52+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53+
54+
To use an external python in cloudslang-cli, set the ``use.jython.expressions``
55+
property to ``false`` in ``cslang-cli/configuration/cslang.properties``.
56+
57+
.. Important::
58+
59+
By default, the property ``use.jython.expressions=true`` is set to ``true``
60+
pointing to use Jython.
61+
62+
#. Unzip the downloaded python 3.8.7 package to any directory. Notice the python-3.8.7 folder after unzipping.
63+
#. Navigate to **cslang-cli/configuration** and open the **cslang.properties** file using any text editor.
64+
#. Specify a property ``python.path`` to point it to the following locations based on your Operating System:
65+
66+
* Windows: **<unzipped_location>/python-3.8.7**
67+
68+
* Linux: **<unzipped_location>/python-3.8.7/bin**
69+
70+
#. Additionally for Linux environment, perform the following steps to grant permissions:
71+
72+
a. Open the terminal shell at **/python-3.8.7/bin** folder, and then run the following command:
73+
74+
.. code:: bash
75+
76+
ln -sf python3 python
77+
78+
b. Navigate back to **/python-3.8.7** folder, and then run the following command. The permission to access the folder is granted.
79+
80+
.. code:: bash
81+
82+
chmod -R 755 bin
83+
5184
Requirements
5285
------------
5386

0 commit comments

Comments
 (0)