Skip to content

Commit

Permalink
Merge pull request #45 from Moduland/dev
Browse files Browse the repository at this point in the history
Version 0.45
  • Loading branch information
sepandhaghighi authored Dec 26, 2020
2 parents f5537cb + b49adbe commit e37d254
Show file tree
Hide file tree
Showing 21 changed files with 524 additions and 291 deletions.
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at info@moduland.ir. All
reported by contacting the project team at info@orangetool.ir. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*.tar.gz
twine upload dist/*.whl
100 changes: 100 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
.venv/
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject
### Example user template template
### Example user template

# IntelliJ project files
.idea
*.iml
out
gen
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ matrix:
install:
- pip install -r requirements.txt
- python setup.py install
- python -m orangetool
before_script:
- pip install --upgrade --upgrade-strategy=only-if-needed -r dev-requirements.txt
- chmod +x test.sh
Expand Down
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.45] - 2020-12-26
### Added
- `FUNDING.yml`
- `__main__.py`
- `__version__` variable
- `hibernate` function
- `usb_control`, `usb_on` and `usb_off` functions
### Changed
- `dev-requirements.txt` modified
- Test system modified
- `DEBUG` parameter renamed to `debug`
- All parameters moved to `orangetool_params.py`
- Some functions moved to `orangetool_utils.py`
- `ADDRESS` parameter renamed to `address`
- `Zone` parameter renamed to `zone`
- `uptime` and `idletime` functions updated
- Docstrings updated
- `README.md` modified
## [0.35] - 2019-06-01
### Added
- `version_check.py`
Expand Down Expand Up @@ -69,7 +81,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Some useful scripts for Orangepi/Raspberrypi boards

[Unreleased]: https://github.com/Moduland/Orangetool/compare/v0.35...dev
[Unreleased]: https://github.com/Moduland/Orangetool/compare/v0.45...dev
[0.45]: https://github.com/Moduland/Orangetool/compare/v0.35...v0.45
[0.35]: https://github.com/Moduland/Orangetool/compare/v0.25...v0.35
[0.25]: https://github.com/Moduland/Orangetool/compare/v0.24...v0.25
[0.24]: https://github.com/Moduland/Orangetool/compare/v0.23...v0.24
Expand Down
43 changes: 28 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ Tested on [Lubuntu](http://lubuntu.me/)
<table>
<tr>
<td align="center">Code Quality</td>
<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>
<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>
<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>
<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>
</tr>
</table>
Expand All @@ -83,13 +84,13 @@ By [Moduland Co](http://www.moduland.ir)

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

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

#5- set_ip

set_ip("192.168.1.46","eth0") #this function set static ip for system
orangetool.set_ip("192.168.1.46","eth0") #this function set static ip for system

#6- mac

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

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

#6- usb_on

orangetool.usb_on() # This function enable USB

#7- usb_off

orangetool.usb_off() # This function disable USB

```

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

orangetool.sleep() # put system in sleep mode

#2- halt
#2- hibernate

orangetool.hibernate() # put system in hibernate mode

#3- halt

orangetool.halt() # poweroff system

#3- restart
#4- restart

orangetool.restart() # restart system

#4- wakeup
#5- wakeup

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

#5- get_temp
#6- get_temp

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

#6- uptime
#7- uptime

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

#7- idletime
#8- idletime

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


#8- version
#9- version

orangetool.version() # return orangetool version for test

#9- check_update
#10- check_update

orangetool.check_update # Return True if new version is available
orangetool.check_update() # Return True if new version is available

```

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



## Issues & Bug Reports

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

## Dependencies

Expand Down
6 changes: 3 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
psutil==5.7.0
requests==2.23.0
art==4.7
psutil==5.8.0
requests==2.25.1
art==5.1
setuptools>=40.8.0
vulture>=1.0
bandit>=1.5.1
Expand Down
34 changes: 7 additions & 27 deletions orangetool/__init__.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
# -*- coding: utf-8 -*-
"""Orangetool modules."""
"""
MIT License

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

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from .orangetool_display import *
from .orangetool_ip import *
from .orangetool_system import *
from .orangetool_ram import *
from .orangetool_storage import *
__version__ = ORANGETOOL_VERSION
7 changes: 7 additions & 0 deletions orangetool/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
"""Orangetool main."""

from .orangetool_system import version

if __name__ == "__main__":
version()
Loading

0 comments on commit e37d254

Please sign in to comment.