diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 1b337ee..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required( VERSION 2.8 ) -project( versioning ) -enable_testing() - -file(GLOB Files - ${CMAKE_CURRENT_SOURCE_DIR}/metadata.txt - ${CMAKE_CURRENT_SOURCE_DIR}/*.py - ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc - ${CMAKE_CURRENT_SOURCE_DIR}/*.svg - ${CMAKE_CURRENT_SOURCE_DIR}/*.ui - ) - -foreach(File ${Files}) - get_filename_component(BaseName ${File} NAME) - configure_file(${File} ${CMAKE_BINARY_DIR}/${BaseName} COPYONLY) -endforeach() - -add_custom_command( OUTPUT commit_msg_ui.py - COMMAND pyuic4 -o commit_msg_ui.py commit_msg.ui - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/commit_msg.ui ) - -add_custom_target(qgis_plugin ALL DEPENDS commit_msg_ui.py ${Files}) - -add_subdirectory(test) diff --git a/metadata.txt b/metadata.txt index 1158a8c..fa5bce9 100644 --- a/metadata.txt +++ b/metadata.txt @@ -6,7 +6,7 @@ name=versioning qgisMinimumVersion=2.0 description=postgis database versioning -version=0.3 +version=0.4 author=Oslandia email=infos@oslandia.com about=A tool to manage data history, branches, and to work offline with your PostGIS-stored data and QGIS. diff --git a/package.py b/package.py new file mode 100755 index 0000000..6752cea --- /dev/null +++ b/package.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +# coding=UTF-8 + +import os +import zipfile +import tempfile +import shutil + +__currendir = os.path.dirname(__file__) +files = ["README.md", "LICENSE", "metadata.txt"] +for file_ in os.listdir(__currendir): + if file_[-4:]==".svg" or file_[-3:]==".py" or file_[-3:]==".ui": + files.append(file_) + +print files +tmpdir = os.path.join(tempfile.gettempdir(), "qgis_versioning") +print tmpdir +if os.path.isdir(tmpdir): + for file_ in os.listdir(tmpdir): + print "remove ", file_ ,"from", tmpdir + os.remove(os.path.join(tmpdir, file_)) +else: + print "create", tmpdir + os.mkdir(tmpdir) + +for file_ in files: + shutil.copy(os.path.join(__currendir, file_), + os.path.join(tmpdir, file_)) + +with zipfile.ZipFile("qgis_versioning.zip", 'w') as package: + for root, dirs, files in os.walk(tmpdir): + for file_ in files: + package.write(os.path.join(root, file_)) + + diff --git a/test.py b/test.py new file mode 100755 index 0000000..4da6e37 --- /dev/null +++ b/test.py @@ -0,0 +1,39 @@ +#!/usr/bin/python +# coding=UTF-8 + +import os +import sys +from subprocess import Popen, PIPE + +__currendir = os.path.dirname(__file__) +tests = [] +test_directories = ["test"] +for dir_ in test_directories: + test_dir = os.path.join(__currendir, dir_) + for file_ in os.listdir(test_dir): + if file_[-8:]=="_test.py": + tests.append(os.path.join(test_dir, file_)) + +failed = 0 +for i, test in enumerate(tests): + sys.stdout.write("% 4d/%d %s %s"%( + i+1, len(tests), test, "."*max(0, (80-len(test))))) + sys.stdout.flush() + child = Popen(["python", test], stdout=PIPE, stderr=PIPE) + out, err = child.communicate() + if child.returncode: + sys.stdout.write("failed\n") + failed += 1 + else: + sys.stdout.write("ok\n") + +if failed: + sys.stderr.write("%d/%d test failed\n"%(failed, len(tests))) + exit(1) +else: + sys.stdout.write("%d/%d test passed (%d%%)\n"%( + len(tests)-failed, + len(tests), + int((100.*(len(tests)-failed))/len(tests)))) + +exit(0) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 69aaf02..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -file(GLOB tests ${CMAKE_CURRENT_SOURCE_DIR}/*.py) - -foreach(test ${tests}) - add_test( ${test} ${test}) -endforeach()