Skip to content

Commit bb019c0

Browse files
committed
Merge pull request #18 from altendky/master
Add setup.py for Setuptools support
2 parents 43c85df + 2194987 commit bb019c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1391
-1370
lines changed

BusmasterRestbus.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from builtins import *
66
import math
77
from struct import *
8-
import library.importany as im
8+
import canmatrix.importany as im
99
import zipfile
1010
import sys
1111
import os

TODO.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55

66

7-
library/canmatrix.py
7+
canmatrix/canmatrix.py
88
: Definitions should be imported with disassembling not as complete string
99

1010

1111

12-
library/canmatrixGenerateJS.py
12+
canmatrix/canmatrixGenerateJS.py
1313
wrong bits are used if signal is not
1414

1515

@@ -26,7 +26,7 @@ library/canmatrixGenerateJS.py
2626

2727

2828

29-
library/exportarxml.py
29+
canmatrix/exportarxml.py
3030
Well, ..., this is the first attempt to export a arxml-file; I did this without reading any spec;
3131
recievers of signals are missing
3232
: insert Speed - if possible
@@ -41,6 +41,8 @@ library/exportarxml.py
4141

4242

4343

44+
canmatrix/exportkcd.py
45+
: support for extended frames (https://github.com/julietkilo/CANBabel/blob/master/src/main/java/com/github/canbabel/canio/kcd/Message.java) :
4446

4547

4648

@@ -62,33 +64,33 @@ library/exportarxml.py
6264

6365

6466

65-
library/importarxml.py
67+
canmatrix/importarxml.py
6668
Well, ..., this is the first attempt to import a arxml-file; I did this without reading any spec;
6769
: use diagAddress for frame-classification
6870

6971

7072

7173

72-
library/importdbc.py
74+
canmatrix/importdbc.py
7375
support for: VERSION, NS, BS_, SIG_VALTYPE_, BA_DEF_REL == BA_DEF_??, BA_DEF_DEF_REL_ = BA_DEF_DEF_ ??
7476

7577

7678

77-
library/importdbf.py
79+
canmatrix/importdbf.py
7880
support for [START_PARAM_NODE_RX_SIG]
7981
support for [START_PARAM_NODE_TX_MSG]
8082

8183

8284

83-
library/importkcd.py
85+
canmatrix/importkcd.py
8486
baudrate missing
8587
name save
8688
defaults for CAN-Simulation missing
8789
LabelGroup not supported
8890

8991

9092

91-
library/importsym.py
93+
canmatrix/importsym.py
9294
: the signalname should be unique. If same signal-name is used in different mux-ids, the signal-name should be unified. maybe this is an dbc-export-issue not an sym-import-issue
9395
: I don't know what to do with the "/p"-Options in the signal-definition
9496
: what is the differenze between SEND and SENDRECEIVE ?
@@ -106,6 +108,9 @@ library/importsym.py
106108

107109

108110

111+
112+
113+
109114
test/test.py
110115
: support testing of xlsx
111116
: support testing of xlsx
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

library/exportJson.py renamed to canmatrix/exportJson.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from builtins import *
22
#!/usr/bin/env python
33

4-
from library.canmatrix import *
4+
from .canmatrix import *
55
import codecs
66
import json
77
import sys
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

library/exportyaml.py renamed to canmatrix/exportyaml.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22

3-
from library.canmatrix import *
3+
from .canmatrix import *
44
import codecs
55
import yaml
66

File renamed without changes.

library/importany.py renamed to canmatrix/importany.py

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def importany(filename):
3131
db = im.importDbf(filename)
3232
elif filename[-3:] == 'kcd':
3333
db = im.importKcd(filename)
34+
elif filename[-3:] == 'sym':
35+
db = im.importSym(filename)
3436
elif filename[-3:] == 'xls' or filename[-4:] == 'xlsx' :
3537
db = im.importXls(filename)
3638
elif filename[-5:] == 'arxml':
File renamed without changes.

library/importdbc.py renamed to canmatrix/importdbc.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class FollowUps(object):
5656
comment += "\n" + l.decode(dbcCommentEncoding).replace('\\"','"')
5757
except:
5858
print ("Error decoding line: %d (%s)" % (i, line))
59-
if l.endswith('";'):
59+
if l.endswith(b'";'):
6060
followUp = FollowUps.nothing
6161
if signal is not None:
6262
signal.addComment(comment[0:-2])
@@ -66,7 +66,7 @@ class FollowUps(object):
6666
comment += "\n" + l.decode(dbcCommentEncoding).replace('\\"','"')
6767
except:
6868
print ("Error decoding line: %d (%s)" % (i, line))
69-
if l.endswith('";'):
69+
if l.endswith(b'";'):
7070
followUp = FollowUps.nothing
7171
if frame is not None:
7272
frame.addComment(comment[0:-2])
@@ -76,7 +76,7 @@ class FollowUps(object):
7676
comment += "\n" + l.decode(dbcCommentEncoding).replace('\\"','"')
7777
except:
7878
print ("Error decoding line: %d (%s)" % (i, line))
79-
if l.endswith('";'):
79+
if l.endswith(b'";'):
8080
followUp = FollowUps.nothing
8181
if boardUnit is not None:
8282
boardUnit.addComment(comment[0:-2])
File renamed without changes.
File renamed without changes.
File renamed without changes.

library/importxls.py renamed to canmatrix/importxls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from __future__ import print_function
3131
from builtins import *
3232
import math
33-
from library.canmatrix import *
33+
from .canmatrix import *
3434
import xlrd
3535
import codecs
3636

library/importxlsx.py renamed to canmatrix/importxlsx.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from __future__ import division
3030
from builtins import *
3131
import math
32-
from library.canmatrix import *
32+
from .canmatrix import *
3333
import codecs
3434
import zipfile
3535
from xml.etree.ElementTree import iterparse
File renamed without changes.

compare.py

+31-26
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from __future__ import print_function
44
from builtins import *
5-
import library.importany as im
6-
from library.compare import *
5+
import canmatrix.importany as im
6+
from canmatrix.compare import *
77
import sys
88
import codecs
99

@@ -27,25 +27,6 @@
2727
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2828
#DAMAGE.
2929

30-
if len(sys.argv) < 3:
31-
sys.stderr.write('Usage: sys.argv[0] matrix1 matrix2\n')
32-
sys.stderr.write('matrixX can be any of *.dbc|*.dbf|*.kcd|*.arxml\n')
33-
sys.exit(1)
34-
35-
matrix1 = sys.argv[1]
36-
matrix2 = sys.argv[2]
37-
38-
print("Importing " + matrix1 + " ... ")
39-
db1 = im.importany(matrix1)
40-
print("%d Frames found" % (db1._fl._list.__len__()))
41-
42-
print("Importing " + matrix2 + " ... ")
43-
db2 = im.importany(matrix2)
44-
print("%d Frames found" % (db2._fl._list.__len__()))
45-
46-
47-
print("\n\n")
48-
4930

5031
def dumpResult(res, depth = 0):
5132
if res._type is not None and res._result != "equal":
@@ -63,8 +44,32 @@ def dumpResult(res, depth = 0):
6344
for child in res._children:
6445
dumpResult(child, depth+1)
6546

66-
ignore = {}
67-
#ignore["ATTRIBUTE"] = "*"
68-
#ignore["DEFINE"] = "*"
69-
obj = compareDb(db1, db2, ignore)
70-
dumpResult(obj)
47+
def main():
48+
if len(sys.argv) < 3:
49+
sys.stderr.write('Usage: sys.argv[0] matrix1 matrix2\n')
50+
sys.stderr.write('matrixX can be any of *.dbc|*.dbf|*.kcd|*.arxml\n')
51+
sys.exit(1)
52+
53+
matrix1 = sys.argv[1]
54+
matrix2 = sys.argv[2]
55+
56+
print("Importing " + matrix1 + " ... ")
57+
db1 = im.importany(matrix1)
58+
print("%d Frames found" % (db1._fl._list.__len__()))
59+
60+
print("Importing " + matrix2 + " ... ")
61+
db2 = im.importany(matrix2)
62+
print("%d Frames found" % (db2._fl._list.__len__()))
63+
64+
65+
print("\n\n")
66+
67+
68+
ignore = {}
69+
#ignore["ATTRIBUTE"] = "*"
70+
#ignore["DEFINE"] = "*"
71+
obj = compareDb(db1, db2, ignore)
72+
dumpResult(obj)
73+
74+
if __name__ == '__main__':
75+
sys.exit(main())

convert.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#DAMAGE.
2222

2323
from __future__ import print_function
24-
import library.exportall as ex
25-
import library.importall as im
26-
import library.canmatrix as cm
24+
import canmatrix.exportall as ex
25+
import canmatrix.importall as im
26+
import canmatrix.canmatrix as cm
2727
import os
2828
import sys
2929

exampleMerge.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env python3
22

33
# importany laed alle verfuegbaren importfilter
4-
from library.copy import *
5-
import library.importany as im
6-
import library.exportall as ex
4+
from canmatrix.copy import *
5+
import canmatrix.importany as im
6+
import canmatrix.exportall as ex
77
#fuer Fileio:
88
import sys
99

setup.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name = "canmatrix",
5+
version = "0.1",
6+
packages = find_packages(),
7+
entry_points={'console_scripts': ['compare = compare:main',
8+
'convert = convert:main']}
9+
)

test/createTestMatrix.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import sys
55
sys.path.append('..')
66

7-
import library.exportall as ex
8-
from library.canmatrix import *
7+
import canmatrix.exportall as ex
8+
from canmatrix.canmatrix import *
99

1010
#
1111
# create target Matrix

0 commit comments

Comments
 (0)