Skip to content
This repository has been archived by the owner on Jun 4, 2020. It is now read-only.

Commit

Permalink
packaging and test script (remove cmake dep)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmora committed Jan 21, 2016
1 parent 9539cee commit 39e1236
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 31 deletions.
25 changes: 0 additions & 25 deletions CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
name=versioning
qgisMinimumVersion=2.0
description=postgis database versioning
version=0.3
version=0.4
author=Oslandia
[email protected]
about=A tool to manage data history, branches, and to work offline with your PostGIS-stored data and QGIS.
Expand Down
35 changes: 35 additions & 0 deletions package.py
Original file line number Diff line number Diff line change
@@ -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_))


39 changes: 39 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 0 additions & 5 deletions test/CMakeLists.txt

This file was deleted.

0 comments on commit 39e1236

Please sign in to comment.