Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
LabComm
Commits
3e763544
Commit
3e763544
authored
Mar 19, 2015
by
Anders Blomdell
Browse files
Allow python sample classes to be used as sample_ref's
Update packaging
parent
373eac7b
Changes
2
Show whitespace changes
Inline
Side-by-side
lib/python/labcomm2014/LabComm.py
View file @
3e763544
...
...
@@ -375,6 +375,9 @@ class SAMPLE(primitive):
return
encoder
.
encode_type
(
i_SAMPLE
)
def
encode
(
self
,
encoder
,
value
):
if
not
isinstance
(
value
,
type_decl
):
# Probably trying to encode a sample class, grab signature
value
=
value
.
signature
return
encoder
.
encode_int
(
encoder
.
ref_to_index
.
get
(
value
,
0
))
def
decode
(
self
,
decoder
,
obj
=
None
):
...
...
@@ -729,6 +732,9 @@ class Codec(object):
return
True
def
add_ref
(
self
,
ref
,
index
=
0
):
if
not
isinstance
(
ref
,
type_decl
):
# Probably trying to register a sample class, grab signature
ref
=
ref
.
signature
if
index
==
0
:
if
ref
.
sample
in
self
.
ref_to_index
:
return
False
...
...
@@ -783,15 +789,16 @@ class Encoder(Codec):
decl
.
encode_decl
(
self
)
self
.
writer
.
mark_end
(
decl
,
None
)
def
add_ref
(
self
,
decl
,
index
=
0
):
if
not
isinstance
(
decl
,
type_decl
):
decl
=
decl
.
signature
ref
=
sample_ref
(
name
=
decl
.
name
,
decl
=
decl
.
decl
,
sample
=
decl
)
def
add_ref
(
self
,
ref
,
index
=
0
):
if
not
isinstance
(
ref
,
type_decl
):
# Trying to register a sample class
ref
=
ref
.
signature
decl
=
sample_ref
(
name
=
ref
.
name
,
decl
=
ref
.
decl
,
sample
=
ref
)
if
index
==
0
:
self
.
writer
.
mark_begin
(
decl
,
None
)
if
super
(
Encoder
,
self
).
add_ref
(
ref
,
index
):
ref
.
encode_decl
(
self
)
self
.
writer
.
mark_end
(
decl
,
None
)
self
.
writer
.
mark_begin
(
ref
,
None
)
if
super
(
Encoder
,
self
).
add_ref
(
decl
,
index
):
decl
.
encode_decl
(
self
)
self
.
writer
.
mark_end
(
ref
,
None
)
def
encode
(
self
,
object
,
decl
=
None
):
if
decl
==
None
:
...
...
packaging/make_srpm
View file @
3e763544
...
...
@@ -68,7 +68,7 @@ install -m u=r,g=r,o=r lib/csharp/labcomm2014.dll ${RPM_BUILD_ROOT}/usr/lib
# Python
#
install -d
${
RPM_BUILD_ROOT
}
/%{python_sitelib}/labcomm2014
install lib/python/labcomm/*
${
RPM_BUILD_ROOT
}
/%{python_sitelib}/labcomm2014
install lib/python/labcomm
2014
/*
${
RPM_BUILD_ROOT
}
/%{python_sitelib}/labcomm2014
%files
%defattr (-, root, root)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment