Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add setup.py support and rproxy example #106

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ The Application Developmers Guide is the best document to read first.
- Sets the device description to visually show the LAN/WAN/WWAN/Modem/IP Verify status.
- **python_module_list**
- This app will log the python version and modules in the device. It is intended to help with app development to show the python environment within the device.
- **rproxy**
- A reverse proxy similar to port forwarding, except traffic forwarded to a
udp/tcp target will be sourced from the router's IP. This reverse proxy can
be dynamically added to clients as they connect.
- **shell_sample**
- Provides example how to execute commands at OS shell: "ls - al".
- **send_to_server**
Expand Down
18 changes: 18 additions & 0 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def package():
package_script_path = os.path.join('tools', 'bin', 'package_application.py')
app_path = os.path.join(g_app_name)
scan_for_cr(app_path)
setup_script(app_path)

try:
subprocess.check_output('{} {} {}'.format(g_python_cmd, package_script_path, app_path), shell=True)
Expand All @@ -197,6 +198,7 @@ def package_all():
for app in app_dirs:
app_path = os.path.join(app)
scan_for_cr(app_path)
setup_script(app_path)
try:
print('Build app: {}'.format(app_path))
subprocess.check_output('{} {} {}'.format(g_python_cmd, package_script_path, app_path), shell=True)
Expand All @@ -207,6 +209,22 @@ def package_all():
return success


def setup_script(app_path):
# check app_path for setup.py and execute it
setup_path = os.path.join(app_path, 'setup.py')
if os.path.isfile(setup_path):
cwd = os.getcwd()
os.chdir(app_path)
print('Running setup.py for {}'.format(app_path))
try:
out = subprocess.check_output('{} {}'.format(g_python_cmd, 'setup.py'), stderr=subprocess.STDOUT, shell=True).decode()
except subprocess.CalledProcessError as e:
print ('[ERROR]: Exit code != 0')
out = e.output.decode()
print(out)
os.chdir(cwd)


# Get the SDK status from the NCOS device
def status():
status_tree = '/status/system/sdk'
Expand Down
Loading
Loading