From 1cc0099d225098d44b6856ef64c137c5920c94db Mon Sep 17 00:00:00 2001 From: Adnan Hodzic Date: Tue, 21 Jan 2020 23:44:42 +0100 Subject: [PATCH] added necessary files for snap + first working snap version --- bin/auto-cpufreq | 8 ++++++-- requirements.txt | 4 ++++ setup.py | 35 ++++++++++++++++++++++++++++++++++ snap/snapcraft.yaml | 34 +++++++++++++++++++++++++++++++++ {app_source => source}/core.py | 0 5 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 requirements.txt create mode 100644 setup.py create mode 100644 snap/snapcraft.yaml rename {app_source => source}/core.py (100%) diff --git a/bin/auto-cpufreq b/bin/auto-cpufreq index f1ca988..0b7f680 100755 --- a/bin/auto-cpufreq +++ b/bin/auto-cpufreq @@ -1,8 +1,12 @@ #!/usr/bin/env python3 +# +# auto-cpufreq - Automatic CPU speed & power optimizer for Linux +# +# Blog post: http://foolcontrol.org/?p=3124 import sys sys.path.append('../') -from app_source.core import * +from source.core import * # cli @click.command() @@ -20,7 +24,7 @@ def main(monitor, live, daemon, install, log): print("\nExample usage:\nauto-cpufreq --monitor") print("\n-----\n") - s.call(["python3", "auto-cpufreq", "--help"]) + s.call(["python3", "bin/auto-cpufreq", "--help"]) footer(79) else: if daemon: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5984983 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +psutil +click +distro +power \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b32d50f --- /dev/null +++ b/setup.py @@ -0,0 +1,35 @@ +import os + +from setuptools import setup + +with open('README.md') as readme_file: + readme = readme_file.read() + +this = os.path.dirname(os.path.realpath(__file__)) + +def read(name): + with open(os.path.join(this, name)) as f: + return f.read() +setup( + name='auto-cpufreq', + version='1.0', + description='Automatic CPU speed & power optimizer for Linux', + long_description=readme, + author='Adnan Hodzic', + author_email='adnan@hodzic.org', + url='https://github.com/AdnanHodzic/auto-cpufreq', + packages=['source'], + install_requires=read('requirements.txt'), + include_package_data=True, + zip_safe=True, + licence='GPLv3', + keywords='linux cpu speed power frequency turbo optimzier auto cpufreq', + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Operating System :: POSIX :: Linux' + 'Environment :: Console' + 'Natural Language :: English' + ], + scripts=['bin/auto-cpufreq'] +) \ No newline at end of file diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 0000000..57709a0 --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,34 @@ +name: auto-cpufreq +base: core18 +version: '1.0' # just for humans, typically '1.2+git' or '1.3.2' +summary: Automatic CPU speed & power optimizer for Linux +description: | + Automatic CPU speed & power optimizer for Linux based on active + monitoring of laptop's battery state, CPU usage and system load. + Ultimately allowing you to improve battery life without making + any compromises. + +grade: devel # must be 'stable' to release into candidate/stable channels +confinement: devmode # use 'strict' once you have the right plugs and slots + +parts: + auto-cpufreq: + # See 'snapcraft plugins' + plugin: python + python-version: python3 + source: . + #stage-packages: + # - python3-pip + # - python3-dev + #python-packages: + # - psutil + # - click + # - distro + # - power + +apps: + auto-cpufreq: + command: bin/auto-cpufreq + environment: + LC_ALL: C.UTF-8 + LANG: C.UTF-8 \ No newline at end of file diff --git a/app_source/core.py b/source/core.py similarity index 100% rename from app_source/core.py rename to source/core.py