Skip to content

Commit 2b63ceb

Browse files
committed
Merge branch 'release/1.3.0'
2 parents e7c24f8 + f05430e commit 2b63ceb

6 files changed

Lines changed: 205 additions & 64 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
*.lastlogin
22
*__pycache__*
33
*.vscode*
4-
*build*
5-
*.egg*
4+
*build/*
5+
*.egg*

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [1.3.0](https://github.com/rdkcentral/xts_core/compare/1.2.1...1.3.0)
8+
9+
- Update #9 - Create build script to simplify and standardise building the xts app [`ac40bdc`](https://github.com/rdkcentral/xts_core/commit/ac40bdc4d1d2d6e3be7f87cb77e2687faa40e6eb)
10+
- Merge tag '1.2.1' into develop [`5110704`](https://github.com/rdkcentral/xts_core/commit/5110704919f5b9dab3fd619f93d904e374cf3678)
11+
712
#### [1.2.1](https://github.com/rdkcentral/xts_core/compare/1.2.0...1.2.1)
813

14+
> 13 May 2025
15+
916
- GH18 - namespace error [`#23`](https://github.com/rdkcentral/xts_core/pull/23)
1017
- GH17 - refactor add and remove slot methods [`#20`](https://github.com/rdkcentral/xts_core/pull/20)
1118
- fix allocator add to work as expected [`080a915`](https://github.com/rdkcentral/xts_core/commit/080a9156e9b5c2c062df8f0ad2e957c9ad2ac7b6)

bin/xts

Lines changed: 0 additions & 26 deletions
This file was deleted.

build.sh

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
#!/usr/bin/env bash
2+
#** *****************************************************************************
3+
# *
4+
# * If not stated otherwise in this file or this component's LICENSE file the
5+
# * following copyright and licenses apply:
6+
# *
7+
# * Copyright 2024 RDK Management
8+
# *
9+
# * Licensed under the Apache License, Version 2.0 (the "License");
10+
# * you may not use this file except in compliance with the License.
11+
# * You may obtain a copy of the License at
12+
# *
13+
# *
14+
# http://www.apache.org/licenses/LICENSE-2.0
15+
# *
16+
# * Unless required by applicable law or agreed to in writing, software
17+
# * distributed under the License is distributed on an "AS IS" BASIS,
18+
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
# * See the License for the specific language governing permissions and
20+
# * limitations under the License.
21+
# *
22+
#* ******************************************************************************
23+
24+
MY_PATH="$(realpath ${BASH_SOURCE[0]})"
25+
MY_DIR="$(dirname ${MY_PATH})"
26+
27+
NO_COLOR="\e[0m"
28+
RED="\e[0;31m"
29+
CYAN="\e[0;36m"
30+
YELLOW="\e[1;33m"
31+
GREEN="\e[0;32m"
32+
RED_BOLD="\e[1;31m"
33+
BLUE_BOLD="\e[1;34m"
34+
YELLOW_BOLD="\e[1;33m"
35+
36+
DEBUG_FLAG=0
37+
function ECHO()
38+
{
39+
echo -e "$*"
40+
}
41+
42+
function DEBUG()
43+
{
44+
# if set -x is in use debug messages are useless as whole stript will be shown
45+
if [[ "$-" =~ "x" ]]; then
46+
return
47+
fi
48+
if [[ "${DEBUG_FLAG}" == "1" ]];then
49+
ECHO "${BLUE_BOLD}DEBUG: ${CYAN}$*${NO_COLOR}" > /dev/stderr
50+
fi
51+
}
52+
53+
function INFO()
54+
{
55+
ECHO "${GREEN}$*${NO_COLOR}"
56+
}
57+
58+
function WARNING()
59+
{
60+
ECHO "${YELLOW_BOLD}Warning: ${YELLOW}$*${NO_COLOR}" > /dev/stderr
61+
}
62+
63+
function ERROR()
64+
{
65+
ECHO "${RED_BOLD}ERROR: ${RED}$*${NO_COLOR}"
66+
exit 1
67+
}
68+
69+
function version_check()
70+
{
71+
# Check if a version is correct or not
72+
# Arguments:
73+
# $1: Version to check
74+
# $2: Required version
75+
# +: as the last character can be used to signify any version over the given number.
76+
# -: as the last character can be used to signify any version below the given number.
77+
#
78+
DEBUG "${FUNCNAME} $*"
79+
local check_version="$1"
80+
local required_version="$2"
81+
local check_version_split=(${check_version//\./" "})
82+
local req_version_split=(${required_version//\./" "})
83+
local stop=$(("${#req_version_split[@]}"-1))
84+
for i in $(seq 0 ${stop})
85+
do
86+
local req_version_section="${req_version_split[$i]}"
87+
DEBUG "Req Version Sect: [${req_version_section}]"
88+
local check_version_section="${check_version_split[$i]}"
89+
DEBUG "Check Version Sect: [${check_version_section}]"
90+
case "${req_version_section}" in
91+
*"+")
92+
# Remove the + from the end of the string
93+
req_version_section="${req_version_section%+}"
94+
if [[ "$check_version_section" -ge "${req_version_section}" ]];then
95+
return 1
96+
fi
97+
return 0
98+
;;
99+
*"-")
100+
# Remove the - from end of the string
101+
req_version_section="${req_version_section%-}"
102+
if [[ "$check_version_section" -le "${req_version_section}" ]];then
103+
return 1
104+
fi
105+
return 0
106+
;;
107+
*)
108+
if [[ "${check_version_section}" != "${req_version_section}" ]];then
109+
return 0
110+
fi
111+
;;
112+
esac
113+
done
114+
return 1
115+
}
116+
117+
function check_python_env()
118+
{
119+
local installed=()
120+
local required=()
121+
readarray -t installed < <(python3 -m pip list | tail -n +3)
122+
readarray -t required < <(cat ${MY_DIR}/requirements.txt | sed 's/[<>=]/ /g')
123+
for req_pkg in "${required[@]}"
124+
do
125+
local match=""
126+
local req_pkg_array=($(echo "${req_pkg}" | awk '{print $1" "$NF}'))
127+
for installed_pkg in "${installed[@]}"
128+
do
129+
local installed_name="$(echo ${installed_pkg}| awk '{print $1}')"
130+
if [[ "${req_pkg_array[0]}" == "${installed_name}" ]];then
131+
match=${installed_pkg}
132+
break
133+
fi
134+
done
135+
if [[ -n "${match}" ]]; then
136+
#Package is installed, check the version
137+
match_version="$(echo ${match} | awk '{print $NF}')"
138+
if (version_check "${match_version}" "${req_pkg_array[1]}+");then
139+
WARNING "Package [${req_pkg_array[0]}] is required to be at verison [${req_pkg_array[1]}+] but is at [${match_version}]"
140+
return 0
141+
fi
142+
else
143+
WARNING "Package [${req_pkg_array[0]}] is not installed"
144+
return 0
145+
fi
146+
done
147+
return 1
148+
}
149+
150+
function create_python_venv()
151+
{
152+
local venv_dir="${MY_DIR}/python_venv"
153+
local create_env=1
154+
if [[ -e "${venv_dir}" ]];then
155+
if [[ -e "${venv_dir}/bin/activate" ]];then
156+
create_env=0
157+
else
158+
ERROR "${venv_dir} already exists but is not a python virtual environment.\n \
159+
please rename or delete it"
160+
fi
161+
fi
162+
if [[ "${create_env}" ]];then
163+
mkdir -p "${venv_dir}"
164+
python3 -m venv "${venv_dir}"
165+
fi
166+
source "${venv_dir}/bin/activate"
167+
pip install -qr "${MY_DIR}/requirements.txt" 2>&1 >/dev/null
168+
}
169+
170+
171+
### MAIN ###
172+
# Check the python3 version is correct
173+
python_version="$(python3 --version | awk '{print $NF}')"
174+
if [[ -n "${python_version}" ]];then
175+
if (version_check "${python_version}" "3.10+");then
176+
ERROR "Installed python3 version is [${python_version}], but version 3.10+ is required"
177+
fi
178+
else
179+
ERROR "python3 is not installed. python 3.10+ is required"
180+
fi
181+
182+
# Check the python environment has the packages required
183+
if (check_python_env);then
184+
WARNING "Python environment incorrect, creating virtual environment"
185+
create_python_venv
186+
fi
187+
188+
# Build the xts_core binary
189+
pyinstaller -F "${MY_DIR}/src/xts.py" --distpath "${MY_DIR}/bin/" > "${MY_DIR}"/build.log 2>&1
190+
191+
INFO "Please run the following commands:\n"
192+
ECHO "export PATH=\"${MY_DIR}/bin:\$PATH\""
193+
INFO "\nTo permanently install this, add the export command as a line in your ~/.bashrc file"

install.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
rich>=13.7.1
2-
git+ssh://git@github.com/rdkcentral/yaml_runner.git@1.0.0
2+
yaml_runner @ git+ssh://git@github.com/rdkcentral/yaml_runner.git@1.0.0
3+
pyinstaller>=6.12.0
4+
requests>=2.32.3

0 commit comments

Comments
 (0)