Reorganize files for setuptools packaging

This commit is contained in:
desbma
2014-11-30 17:41:43 +01:00
parent c446871913
commit 75a8a6eee4
7 changed files with 72 additions and 17 deletions
+1
View File
@@ -0,0 +1 @@
include LICENSE README.md requirements.txt
+16 -8
View File
@@ -45,12 +45,20 @@ Most motherboards and SATA drives fit these requirements.
## Installation ## Installation
HDD Fan control needs Python >= 3.4. It probably works with Python 3.3 with minimum efforts, or even previous 3.x versions, but I have not tested it. **HDD Fan control needs Python >= 3.4.**
1. Clone this repository ### From PyPI (with PIP)
2. If you don't have it, [install pip](http://www.pip-installer.org/en/latest/installing.html) for Python3 (may not be needed with Python >= 3.4).
On Ubuntu and other Debian derivatives, you can install with `sudo apt-get install python3-pip` 1. If you don't already have it, [install pip](http://www.pip-installer.org/en/latest/installing.html) for Python 3 (not needed if you are using Python >= 3.4)
3. Install Python dependencies: `pip3 install -r requirements.txt` 2. Install HDD Fan control: `pip3 install hddfancontrol`
3. Install [hdparm](http://sourceforge.net/projects/hdparm/) and [hddtemp](http://www.guzu.net/linux/hddtemp.php).
On Ubuntu and other Debian derivatives: `sudo apt-get install hdparm hddtemp`.
### From source
1. If you don't already have it, [install setuptools](https://pypi.python.org/pypi/setuptools#installation-instructions) for Python 3
2. Clone this repository: `git clone https://github.com/desbma/hddfancontrol`
3. Install HDD Fan control: `python3 setup.py install`
4. Install [hdparm](http://sourceforge.net/projects/hdparm/) and [hddtemp](http://www.guzu.net/linux/hddtemp.php). 4. Install [hdparm](http://sourceforge.net/projects/hdparm/) and [hddtemp](http://www.guzu.net/linux/hddtemp.php).
On Ubuntu and other Debian derivatives: `sudo apt-get install hdparm hddtemp`. On Ubuntu and other Debian derivatives: `sudo apt-get install hdparm hddtemp`.
@@ -92,7 +100,7 @@ Some Hitachi (now HGST) drives support a special way of querying temperature tha
## Command line usage ## Command line usage
Run `./hdd_fancontrol.py -h` to get full command line reference. Run `hddfancontrol -h` to get full command line reference.
As an example, the command line below will instruct HDD Fan control to: As an example, the command line below will instruct HDD Fan control to:
@@ -105,9 +113,9 @@ As an example, the command line below will instruct HDD Fan control to:
* monitor drive activity using special files `/sys/block/sda/stat` and `/sys/block/sdb/stat` * monitor drive activity using special files `/sys/block/sda/stat` and `/sys/block/sdb/stat`
* automatically spin down drives if they are inactive for 2 hours (7200 seconds) * automatically spin down drives if they are inactive for 2 hours (7200 seconds)
* run in daemon mode * run in daemon mode
* log what is going on to `/var/log/hdd_fancontrol.log` * log what is going on to `/var/log/hddfancontrol.log`
`./hdd_fancontrol.py -d /dev/sda /dev/sdb -p /sys/class/hwmon/hwmon1/device/pwm2 /sys/class/hwmon/hwmon1/device/pwm3 --pwm-start-value 200 200 --pwm-stop-value 75 75 --min-fan-speed-prct 10 -i 60 --stat-files /sys/block/sda/stat /sys/block/sdb/stat --spin-down-time 7200 -b -l /var/log/hdd_fancontrol.log` `hddfancontrol -d /dev/sda /dev/sdb -p /sys/class/hwmon/hwmon1/device/pwm2 /sys/class/hwmon/hwmon1/device/pwm3 --pwm-start-value 200 200 --pwm-stop-value 75 75 --min-fan-speed-prct 10 -i 60 --stat-files /sys/block/sda/stat /sys/block/sdb/stat --spin-down-time 7200 -b -l /var/log/hddfancontrol.log`
## License ## License
@@ -21,8 +21,8 @@ import time
import daemon import daemon
import daemon.pidlockfile import daemon.pidlockfile
import bin_dep from . import bin_dep
import colored_logging from . import colored_logging
exit_evt = threading.Event() exit_evt = threading.Event()
@@ -489,13 +489,10 @@ def main(drive_filepaths, fan_pwm_filepaths, fan_start_values, fan_stop_values,
logger.error(e) logger.error(e)
# check deps def cl_main():
bin_dep.check_bin_dependency(("hddtemp", "hdparm"))
if __name__ == "__main__":
# parse args # parse args
arg_parser = argparse.ArgumentParser(description=__doc__) arg_parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
arg_parser.add_argument("-d", arg_parser.add_argument("-d",
"--drives", "--drives",
required=True, required=True,
@@ -647,3 +644,11 @@ if __name__ == "__main__":
args.interval_s, args.interval_s,
args.spin_down_time_s, args.spin_down_time_s,
args.stat_filepaths) args.stat_filepaths)
# check deps
bin_dep.check_bin_dependency(("hddtemp", "hdparm"))
if __name__ == "__main__":
cl_main()
+1 -1
View File
@@ -1 +1 @@
-e git+https://github.com/Yuego/python-daemon@1.5.5#egg=python-daemon-py3k python-daemon-3K>=1.5.8
Executable
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
VERSION = "1.0.0"
with open("requirements.txt", "rt") as f:
requirements = f.read().splitlines()
with open("README.md", "rt") as f:
readme = f.read()
setup(name="hddfancontrol",
version=VERSION,
author="desbma",
packages=find_packages(),
entry_points={"console_scripts": ["hddfancontrol = hddfancontrol:cl_main"]},
install_requires=requirements,
description="Control system fan speed by monitoring hard drive temperature",
long_description=readme,
url="https://github.com/desbma/hddfancontrol",
download_url="https://github.com/desbma/hddfancontrol/archive/%s.tar.gz" % (VERSION),
keywords=["hdd", "drive", "temperature", "fan", "control", "speed"],
classifiers=["Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: No Input/Output (Daemon)",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Topic :: System :: Hardware",
"Topic :: System :: Monitoring",
"Topic :: Utilities"])