Skip to content

Commit

Permalink
Merge pull request #106 from cradlepoint/dapplegate/setup
Browse files Browse the repository at this point in the history
add setup.py support and rproxy example
  • Loading branch information
phate999 authored Dec 22, 2023
2 parents 4fbb5d3 + f9e8e46 commit 8dd49ba
Show file tree
Hide file tree
Showing 8 changed files with 871 additions and 0 deletions.
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

0 comments on commit 8dd49ba

Please sign in to comment.