Browse Source

Moved stuff around; added VERSION to __init__.py

tags/0.3.1
Johann Schmitz 2 years ago
parent
commit
a5c835fb77
8 changed files with 31 additions and 11 deletions
  1. 18
    6
      Makefile
  2. 4
    3
      setup.py
  3. 1
    0
      smartcheck/__init__.py
  4. 7
    1
      smartcheck/__main__.py
  5. 0
    0
      smartcheck/check.py
  6. 0
    0
      smartcheck/convert.py
  7. 0
    0
      smartcheck/disks.yaml
  8. 1
    1
      tests/check.py

+ 18
- 6
Makefile View File

@@ -1,29 +1,41 @@
TARGET?=tests

VERSION := $(shell grep -Po '"(.*)"' smartcheck/__init__.py | sed -e 's/"//g')

test_default_python:
PYTHONPATH=".:./src" python tests/ -v
python tests/ -v

test_py2:
@echo Executing test with python2
PYTHONPATH=".:./src" python2 tests/ -v
python2 tests/ -v

test_py3:
@echo Executing test with python3
PYTHONPATH=".:./src" python3 tests/ -v
python3 tests/ -v

test: test_py2 test_py3

compile:
@echo Compiling python code
python -m compileall src/
python -m compileall smartcheck/

compile_optimized:
@echo Compiling python code optimized
python -O -m compileall src/
python -O -m compileall smartcheck/

coverage:
coverage erase
PYTHONPATH=".:./src" coverage run --source='src' --branch tests/__main__.py
coverage run --source='.' --omit 'tests/*,setup.py' --branch tests/__main__.py
coverage report -m

sonar:
/usr/local/bin/sonar-scanner/bin/sonar-scanner -Dsonar.projectVersion=$(VERSION)

clean:
find -name "*.py?" -delete
rm -f coverage.xml testresults.xml
rm -fr htmlcov dist build smart_check.egg-info

travis: compile compile_optimized test_default_python coverage

jenkins: travis sonar

+ 4
- 3
setup.py View File

@@ -3,16 +3,17 @@

from setuptools import setup, find_packages

from smartcheck import VERSION

setup(
name='smart-check',
version='0.3',
version=VERSION,
description='A smart S.M.A.R.T. check',
author='Johann Schmitz',
author_email='johann@j-schmitz.net',
url='https://ercpe.de/projects/smart-check',
download_url='https://code.not-your-server.de/smart-check.git/tags/',
packages=find_packages('src'),
package_dir={'': 'src'},
packages=find_packages('.'),
include_package_data=True,
package_data = {'': ['*.yaml']},
zip_safe=False,

src/smartcheck/__init__.py → smartcheck/__init__.py View File

@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-

VERSION="0.3.1"

src/smartcheck/main.py → smartcheck/__main__.py View File

@@ -1,11 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
import os
import shlex
import sys
import logging
import subprocess

from smartcheck import VERSION
from smartcheck.check import SMARTCheck, AttributeWarning, DEFAULT_DISKS_FILE


@@ -47,9 +48,14 @@ if __name__ == "__main__":
parser.add_argument('--ignore-attributes', help='Ignore this S.M.A.R.T. attributes (id or name)', nargs='*')
parser.add_argument('-v', '--verbose', help='Verbose messages', action='store_true', default=False)
parser.add_argument('--debug', help="Print debug messages", action="store_true", default=False)
parser.add_argument('--version', action='store_true', dest='version', help='show version and exit')

args = parser.parse_args()

if args.version:
print("smart-check %s" % VERSION)
sys.exit(0)

if args.file and any([args.interface, args.drive]):
parser.error('-f/--file cannot be used with a device and/or -i/--interface')


src/smartcheck/check.py → smartcheck/check.py View File


src/smartcheck/convert.py → smartcheck/convert.py View File


src/smartcheck/disks.yaml → smartcheck/disks.yaml View File


+ 1
- 1
tests/check.py View File

@@ -4,7 +4,7 @@ import os
from smartcheck.check import SMARTCheck, AttributeWarning

samples_path = os.path.join(os.path.dirname(__file__), 'samples')
db_path = os.path.join(samples_path, '../../src/smartcheck/disks.yaml')
db_path = os.path.join(samples_path, '../../smartcheck/disks.yaml')

class CheckTest(unittest.TestCase):


Loading…
Cancel
Save