Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dssp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
dssp
Commits
244f8b7b
Commit
244f8b7b
authored
Aug 11, 2020
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version info
parent
b241a779
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
4 deletions
+87
-4
GNUmakefile.in
+16
-2
src/dssp.cpp
+71
-2
No files found.
GNUmakefile.in
View file @
244f8b7b
...
...
@@ -92,8 +92,8 @@ OBJECTS = $(APPLICATION:%=$(OBJDIR)/%.o)
ifneq
"$(MRC)"
""
OBJECTS
+=
$
(
APPLICATION:%
=
$(OBJDIR)
/%_rsrc.o
)
$(OBJDIR)/$(APPLICATION)_rsrc.o
:
$(wildcard $(CIFPP_RSRC)/dictionaries/*)
$(MRC)
-o
$@
$(CIFPP_RSRC)
/dictionaries
$(OBJDIR)/$(APPLICATION)_rsrc.o
:
$(wildcard $(CIFPP_RSRC)/dictionaries/*)
rsrc/version.txt
$(MRC)
-o
$@
$(CIFPP_RSRC)
/dictionaries
rsrc/version.txt
endif
-include $(OBJECTS
:
%.o=%.d)
...
...
@@ -104,6 +104,20 @@ $(OBJDIR)/%.o: %.cpp | $(OBJDIR) GNUmakefile
@
echo
">>"
$<
@
$(CXX)
-MD
-c
-o
$@
$<
$(CFLAGS)
$(CXXFLAGS)
REVISION
=
$(
shell
git log
--pretty
=
format:%h
--max-count
=
1
)
REVISION_FILE
=
version-info-
$(REVISION)
.txt
$(REVISION_FILE)
:
$(OBJDIR) src
rm
-f
version-info-
*
.txt
git describe
--match
=
build
--dirty
>
$@
git log
--pretty
=
medium
--date
=
iso8601
-1
>>
$@
rsrc
:
@
mkdir
-p
$@
rsrc/version.txt
:
$(REVISION_FILE) | rsrc
cp
$?
$@
all
:
$(APPLICATION)
.PHONY
:
all
...
...
src/dssp.cpp
View file @
244f8b7b
...
...
@@ -17,6 +17,8 @@
#include <cif++/Cif2PDB.hpp>
#include <cif++/FixDMC.hpp>
#include <zeep/streambuf.hpp>
#include <boost/program_options.hpp>
namespace
po
=
boost
::
program_options
;
...
...
@@ -40,6 +42,62 @@ void print_what (const std::exception& e)
// --------------------------------------------------------------------
namespace
{
std
::
string
gVersionNr
,
gVersionDate
,
VERSION_STRING
;
}
void
load_version_info
()
{
const
std
::
regex
rxVersionNr
(
R"(build-(\d+)-g[0-9a-f]{7}(-dirty)?)"
),
rxVersionDate
(
R"(Date: +(\d{4}-\d{2}-\d{2}).*)"
);
auto
version
=
cif
::
rsrc_loader
::
load
(
"version.txt"
);
if
(
not
version
)
VERSION_STRING
=
"unknown version, version resource is missing"
;
else
{
zeep
::
char_streambuf
buffer
(
version
.
data
(),
version
.
size
());
std
::
istream
is
(
&
buffer
);
std
::
string
line
;
while
(
getline
(
is
,
line
))
{
std
::
smatch
m
;
if
(
std
::
regex_match
(
line
,
m
,
rxVersionNr
))
{
gVersionNr
=
m
[
1
];
if
(
m
[
2
].
matched
)
gVersionNr
+=
'*'
;
continue
;
}
if
(
regex_match
(
line
,
m
,
rxVersionDate
))
{
gVersionDate
=
m
[
1
];
continue
;
}
}
if
(
not
VERSION_STRING
.
empty
())
VERSION_STRING
+=
"
\n
"
;
VERSION_STRING
+=
gVersionNr
+
" "
+
gVersionDate
;
}
}
std
::
string
get_version_nr
()
{
return
gVersionNr
;
}
std
::
string
get_version_date
()
{
return
gVersionDate
;
}
// --------------------------------------------------------------------
std
::
string
ResidueToDSSPLine
(
const
mmcif
::
DSSP
::
ResidueInfo
&
info
)
{
/*
...
...
@@ -267,7 +325,6 @@ void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, std::ost
auto
&
structConf
=
db
[
"struct_conf"
];
structConf
.
clear
();
std
::
map
<
std
::
string
,
int
>
foundTypes
;
auto
st
=
dssp
.
begin
(),
lt
=
st
;
...
...
@@ -373,6 +430,8 @@ void annotateDSSP(mmcif::Structure& structure, const mmcif::DSSP& dssp, std::ost
}
}
db
.
add_software
(
"dssp "
VERSION
,
"other"
,
get_version_nr
(),
get_version_date
());
db
.
write
(
os
);
// cif::File df;
...
...
@@ -630,7 +689,7 @@ int d_main(int argc, const char* argv[])
if
(
vm
.
count
(
"version"
))
{
std
::
cout
<<
argv
[
0
]
<<
" version "
<<
VERSION
<<
std
::
endl
;
std
::
cout
<<
argv
[
0
]
<<
' '
<<
VERSION
" version "
<<
VERSION_STRING
<<
std
::
endl
;
exit
(
0
);
}
...
...
@@ -722,6 +781,16 @@ int main(int argc, const char* argv[])
try
{
cif
::
rsrc_loader
::
init
({
#if USE_RSRC
{
cif
::
rsrc_loader_type
::
mrsrc
,
""
,
{
gResourceIndex
,
gResourceData
,
gResourceName
}
},
#endif
{
cif
::
rsrc_loader_type
::
file
,
"."
}
});
load_version_info
();
result
=
d_main
(
argc
,
argv
);
}
catch
(
const
std
::
exception
&
ex
)
...
...
Write
Preview
Markdown
is supported
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