Skip to content

Commit e37d254

Browse files
Merge pull request #45 from Moduland/dev
Version 0.45
2 parents f5537cb + b49adbe commit e37d254

21 files changed

+524
-291
lines changed

.github/CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
5555
## Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting the project team at info@moduland.ir. All
58+
reported by contacting the project team at info@orangetool.ir. All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
6161
obligated to maintain confidentiality with regard to the reporter of an incident.

.github/FUNDING.yml

-1
This file was deleted.

.github/workflows/pythonpublish.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
push:
8+
# Sequence of patterns matched against refs/tags
9+
tags:
10+
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10
11+
12+
jobs:
13+
deploy:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: '3.x'
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install setuptools wheel twine
27+
- name: Build and publish
28+
env:
29+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
30+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
31+
run: |
32+
python setup.py sdist bdist_wheel
33+
twine upload dist/*.tar.gz
34+
twine upload dist/*.whl

.gitignore

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Python template
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.Python
13+
env/
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*,cover
48+
.hypothesis/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
58+
# Flask stuff:
59+
instance/
60+
.webassets-cache
61+
62+
# Scrapy stuff:
63+
.scrapy
64+
65+
# Sphinx documentation
66+
docs/_build/
67+
68+
# PyBuilder
69+
target/
70+
71+
# Jupyter Notebook
72+
.ipynb_checkpoints
73+
74+
# pyenv
75+
.python-version
76+
77+
# celery beat schedule file
78+
celerybeat-schedule
79+
80+
# dotenv
81+
.env
82+
83+
# virtualenv
84+
.venv/
85+
venv/
86+
ENV/
87+
88+
# Spyder project settings
89+
.spyderproject
90+
91+
# Rope project settings
92+
.ropeproject
93+
### Example user template template
94+
### Example user template
95+
96+
# IntelliJ project files
97+
.idea
98+
*.iml
99+
out
100+
gen

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ matrix:
3030
install:
3131
- pip install -r requirements.txt
3232
- python setup.py install
33+
- python -m orangetool
3334
before_script:
3435
- pip install --upgrade --upgrade-strategy=only-if-needed -r dev-requirements.txt
3536
- chmod +x test.sh

CHANGELOG.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
## [0.45] - 2020-12-26
89
### Added
9-
- `FUNDING.yml`
10+
- `__main__.py`
11+
- `__version__` variable
12+
- `hibernate` function
13+
- `usb_control`, `usb_on` and `usb_off` functions
1014
### Changed
1115
- `dev-requirements.txt` modified
1216
- Test system modified
17+
- `DEBUG` parameter renamed to `debug`
18+
- All parameters moved to `orangetool_params.py`
19+
- Some functions moved to `orangetool_utils.py`
20+
- `ADDRESS` parameter renamed to `address`
21+
- `Zone` parameter renamed to `zone`
22+
- `uptime` and `idletime` functions updated
23+
- Docstrings updated
24+
- `README.md` modified
1325
## [0.35] - 2019-06-01
1426
### Added
1527
- `version_check.py`
@@ -69,7 +81,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6981
### Added
7082
- Some useful scripts for Orangepi/Raspberrypi boards
7183

72-
[Unreleased]: https://github.com/Moduland/Orangetool/compare/v0.35...dev
84+
[Unreleased]: https://github.com/Moduland/Orangetool/compare/v0.45...dev
85+
[0.45]: https://github.com/Moduland/Orangetool/compare/v0.35...v0.45
7386
[0.35]: https://github.com/Moduland/Orangetool/compare/v0.25...v0.35
7487
[0.25]: https://github.com/Moduland/Orangetool/compare/v0.24...v0.25
7588
[0.24]: https://github.com/Moduland/Orangetool/compare/v0.23...v0.24

README.md

+28-15
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ Tested on [Lubuntu](http://lubuntu.me/)
7171
<table>
7272
<tr>
7373
<td align="center">Code Quality</td>
74-
<td align="center"><a href="https://www.codacy.com/app/sepand-haghighi/Orangetool?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Moduland/Orangetool&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/ad9374e6e7b24a63b34d6a4f419497ac"/></a></td>
74+
<td align="center"><a href="https://www.codacy.com/app/sepand-haghighi/Orangetool?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Moduland/Orangetool&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/ad9374e6e7b24a63b34d6a4f419497ac"/></a></td>
75+
<td align="center"><a href="https://codebeat.co/projects/github-com-moduland-orangetool-dev"><img alt="codebeat badge" src="https://codebeat.co/badges/78f987a9-d504-4d29-b98d-21dd1f2d319e" /></a></td>
7576
<td align="center"><a href="https://www.codefactor.io/repository/github/moduland/orangetool"><img src="https://www.codefactor.io/repository/github/moduland/orangetool/badge" alt="CodeFactor" /></a></td>
7677
</tr>
7778
</table>
@@ -83,13 +84,13 @@ By [Moduland Co](http://www.moduland.ir)
8384

8485
## Installation
8586
### Source Code
86-
- Download [Version 0.35](https://github.com/moduland/Orangetool/archive/v0.35.zip) or [Latest Source ](https://github.com/Moduland/Orangetool/archive/dev.zip)
87+
- Download [Version 0.45](https://github.com/moduland/Orangetool/archive/v0.45.zip) or [Latest Source ](https://github.com/Moduland/Orangetool/archive/dev.zip)
8788
- `pip3 install -r requirements.txt` or `pip install -r requirements.txt` (Need root access)
8889
- `python3 setup.py install` or `python setup.py install`
8990
### PyPI
9091

9192
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
92-
- `pip3 install orangetool==0.35` or `pip install orangetool==0.35` (Need root access)
93+
- `pip3 install orangetool==0.45` or `pip install orangetool==0.45` (Need root access)
9394
<div align="center">
9495
<a href="https://asciinema.org/a/141548" target="_blank"><img src="https://asciinema.org/a/141548.png" /></a>
9596
</div>
@@ -128,7 +129,7 @@ ip_status=orangetool.ping(ip_address) #this function check ip and return True if
128129

129130
#5- set_ip
130131

131-
set_ip("192.168.1.46","eth0") #this function set static ip for system
132+
orangetool.set_ip("192.168.1.46","eth0") #this function set static ip for system
132133

133134
#6- mac
134135

@@ -188,6 +189,14 @@ orangetool.unmount_all() #This function unmount all of the mounted devices
188189

189190
orangetool.mount("sda1","/mnt/usb1") # This function mount input device in input addresses
190191

192+
#6- usb_on
193+
194+
orangetool.usb_on() # This function enable USB
195+
196+
#7- usb_off
197+
198+
orangetool.usb_off() # This function disable USB
199+
191200
```
192201

193202
### Display Functions
@@ -214,38 +223,42 @@ orangetool.hdmi_size(1280,720) # this function change hdmi display resolution
214223

215224
orangetool.sleep() # put system in sleep mode
216225

217-
#2- halt
226+
#2- hibernate
227+
228+
orangetool.hibernate() # put system in hibernate mode
229+
230+
#3- halt
218231

219232
orangetool.halt() # poweroff system
220233

221-
#3- restart
234+
#4- restart
222235

223236
orangetool.restart() # restart system
224237

225-
#4- wakeup
238+
#5- wakeup
226239

227240
orangetool.wakeup(day=1,hour=0,minute=1) # set rtc wakeuptime
228241

229-
#5- get_temp
242+
#6- get_temp
230243

231244
temp=orangetool.get_temp() # this function return cpu temperature as string
232245

233-
#6- uptime
246+
#7- uptime
234247

235248
time=orangetool.uptime() # this function return uptime of system
236249

237-
#7- idletime
250+
#8- idletime
238251

239252
time=orangetool.idletime() # this function return idle of system ( all cores)
240253

241254

242-
#8- version
255+
#9- version
243256

244257
orangetool.version() # return orangetool version for test
245258

246-
#9- check_update
259+
#10- check_update
247260

248-
orangetool.check_update # Return True if new version is available
261+
orangetool.check_update() # Return True if new version is available
249262

250263
```
251264

@@ -255,15 +268,15 @@ orangetool.check_update # Return True if new version is available
255268
- `local_ip` and `global_ip` originally are available in ipz package [Link](http://github.com/sepandhaghighi/ipz)
256269
- RAM functions in this version need psutil package
257270
- Running `set_ip` function remotely will freeze your terminal so it's better to set `restart` parameter to True
258-
- Running `halt`,`restart` & `sleep` functions remotely will freeze your terminal
271+
- Running `halt`,`restart`,`hibernate` & `sleep` functions remotely will freeze your terminal
259272
- Some of funtions need root access so it's better to run ```sudo -s``` before use this tool
260273

261274

262275

263276
## Issues & Bug Reports
264277

265278
Just fill an issue and describe it. We'll check it ASAP!
266-
or send an email to [info@moduland.ir](mailto:info@moduland.ir "info@moduland.ir").
279+
or send an email to [info@orangetool.ir](mailto:info@orangetool.ir "info@orangetool.ir").
267280

268281
## Dependencies
269282

dev-requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
psutil==5.7.0
2-
requests==2.23.0
3-
art==4.7
1+
psutil==5.8.0
2+
requests==2.25.1
3+
art==5.1
44
setuptools>=40.8.0
55
vulture>=1.0
66
bandit>=1.5.1

orangetool/__init__.py

+7-27
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
11
# -*- coding: utf-8 -*-
22
"""Orangetool modules."""
3-
"""
4-
MIT License
53

6-
Copyright (c) 2017 Moduland Co
4+
from .orangetool_display import hdmi_on, hdmi_off, hdmi_size
5+
from .orangetool_ip import internet, local_ip, global_ip, set_ip, ping, mac
6+
from .orangetool_system import check_update, get_temp, uptime, idletime, wakeup, version, sleep, hibernate, halt, restart
7+
from .orangetool_ram import ram_total, ram_used, ram_free, ram_percent, freeup
8+
from .orangetool_storage import mount_status, storage_status, unmount, unmount_all, mount, usb_on, usb_off
9+
from .orangetool_params import ORANGETOOL_VERSION
710

8-
Permission is hereby granted, free of charge, to any person obtaining a copy
9-
of this software and associated documentation files (the "Software"), to deal
10-
in the Software without restriction, including without limitation the rights
11-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12-
copies of the Software, and to permit persons to whom the Software is
13-
furnished to do so, subject to the following conditions:
14-
15-
The above copyright notice and this permission notice shall be included in all
16-
copies or substantial portions of the Software.
17-
18-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24-
SOFTWARE.
25-
"""
26-
27-
from .orangetool_display import *
28-
from .orangetool_ip import *
29-
from .orangetool_system import *
30-
from .orangetool_ram import *
31-
from .orangetool_storage import *
11+
__version__ = ORANGETOOL_VERSION

orangetool/__main__.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# -*- coding: utf-8 -*-
2+
"""Orangetool main."""
3+
4+
from .orangetool_system import version
5+
6+
if __name__ == "__main__":
7+
version()

0 commit comments

Comments
 (0)