Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graintracking
DCT
Commits
245d84c1
Commit
245d84c1
authored
12 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
Python/setup: Fixed matlab mexopts generation
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
f01e15b8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zUtil_Python/dct_setup.py
+18
-5
18 additions, 5 deletions
zUtil_Python/dct_setup.py
zUtil_Python/dct_utils_platform.py
+17
-10
17 additions, 10 deletions
zUtil_Python/dct_utils_platform.py
with
35 additions
and
15 deletions
zUtil_Python/dct_setup.py
+
18
−
5
View file @
245d84c1
...
@@ -22,6 +22,7 @@ class DCTSetup(object):
...
@@ -22,6 +22,7 @@ class DCTSetup(object):
self
.
repo_dir
=
""
self
.
repo_dir
=
""
self
.
sf_username
=
""
self
.
sf_username
=
""
self
.
matlab_ver
=
"
2012a
"
self
.
matlab_ver
=
"
2012a
"
self
.
matlab_path
=
""
self
.
gcc_version
=
""
self
.
gcc_version
=
""
self
.
git_version
=
""
self
.
git_version
=
""
...
@@ -59,6 +60,12 @@ class DCTSetup(object):
...
@@ -59,6 +60,12 @@ class DCTSetup(object):
self
.
matlab_ver
=
args
[
index
+
1
]
self
.
matlab_ver
=
args
[
index
+
1
]
else
:
else
:
raise
ValueError
(
"
Not enough arguments to
'
-m
'
option
"
)
raise
ValueError
(
"
Not enough arguments to
'
-m
'
option
"
)
elif
args
[
index
]
==
"
-mp
"
:
skip_next
=
True
if
len
(
args
)
>
(
index
+
1
):
self
.
matlab_path
=
args
[
index
+
1
]
else
:
raise
ValueError
(
"
Not enough arguments to
'
-mp
'
option
"
)
elif
args
[
index
]
==
"
--help
"
or
args
[
index
]
==
"
-h
"
:
elif
args
[
index
]
==
"
--help
"
or
args
[
index
]
==
"
-h
"
:
raise
ValueError
(
""
)
raise
ValueError
(
""
)
else
:
else
:
...
@@ -102,6 +109,7 @@ class DCTSetup(object):
...
@@ -102,6 +109,7 @@ class DCTSetup(object):
print
(
"
-d <dir_name> : to specify directory name, where dct will be
"
)
print
(
"
-d <dir_name> : to specify directory name, where dct will be
"
)
print
(
"
-u <user_name> : selects developer mode and specifies the developer sf_username
"
)
print
(
"
-u <user_name> : selects developer mode and specifies the developer sf_username
"
)
print
(
"
-m <matlab_version> : selects the matlab version to be used
"
)
print
(
"
-m <matlab_version> : selects the matlab version to be used
"
)
print
(
"
-mp <matlab_path> : selects the path to matlab (not needed at ESRF)
"
)
def
printRepoSummary
(
self
):
def
printRepoSummary
(
self
):
print
(
"
\n
Git repository information:
"
)
print
(
"
\n
Git repository information:
"
)
...
@@ -128,7 +136,8 @@ class DCTSetup(object):
...
@@ -128,7 +136,8 @@ class DCTSetup(object):
self
.
git_version
=
platform_utils
.
checkGitVersion
()
self
.
git_version
=
platform_utils
.
checkGitVersion
()
# platform_utils.checkSvnServers()
# platform_utils.checkSvnServers()
self
.
gcc_version
=
platform_utils
.
checkGccVersion
()
self
.
gcc_version
=
platform_utils
.
checkGccVersion
()
platform_utils
.
checkMatlabGccVersion
(
self
.
matlab_ver
)
platform_utils
.
checkMatlabGccVersion
(
matlabVersion
=
self
.
matlab_ver
,
\
matlabPath
=
self
.
matlab_path
)
def
prepareUserEnvironment
(
self
,
proxy
=
""
):
def
prepareUserEnvironment
(
self
,
proxy
=
""
):
if
proxy
is
not
""
:
if
proxy
is
not
""
:
...
@@ -153,10 +162,14 @@ if __name__ == '__main__':
...
@@ -153,10 +162,14 @@ if __name__ == '__main__':
dct_sup
.
system_type
=
utils
.
getSystemDescription
()
dct_sup
.
system_type
=
utils
.
getSystemDescription
()
DCTOutput
.
printJob
(
"
Checking system...
"
)
DCTOutput
.
printJob
(
"
Checking system...
"
)
dct_sup
.
checkSystem
(
utils
)
try
:
dct_sup
.
prepareUserEnvironment
(
"
proxy.esrf.fr:3128
"
)
# assuming ESRF
dct_sup
.
checkSystem
(
utils
)
if
dct_sup
.
sf_username
is
not
""
:
dct_sup
.
prepareUserEnvironment
(
"
proxy.esrf.fr:3128
"
)
# assuming ESRF
dct_sup
.
prepareDeveloperEnvironment
(
utils
)
if
dct_sup
.
sf_username
is
not
""
:
dct_sup
.
prepareDeveloperEnvironment
(
utils
)
except
ValueError
as
ex
:
DCTOutput
.
printError
(
ex
.
args
)
sys
.
exit
(
1
)
DCTOutput
.
printJob
(
"
Done.
"
)
DCTOutput
.
printJob
(
"
Done.
"
)
dct_sup
.
printSystemSummary
()
dct_sup
.
printSystemSummary
()
...
...
This diff is collapsed.
Click to expand it.
zUtil_Python/dct_utils_platform.py
+
17
−
10
View file @
245d84c1
...
@@ -62,8 +62,6 @@ class UtilsInterface(object):
...
@@ -62,8 +62,6 @@ class UtilsInterface(object):
def
checkSvnServers
(
self
):
def
checkSvnServers
(
self
):
import
re
svnservers
=
self
.
_getSvnServersPath
()
svnservers
=
self
.
_getSvnServersPath
()
try
:
try
:
...
@@ -113,14 +111,16 @@ class UtilsInterface(object):
...
@@ -113,14 +111,16 @@ class UtilsInterface(object):
return
version_txt
return
version_txt
def
checkMatlabGccVersion
(
self
,
matlabVersion
,
searchPatterns
):
def
checkMatlabGccVersion
(
self
,
searchPatterns
,
matlabVersion
,
\
import
re
matlabPath
=
""
):
import
stat
import
stat
mexoptsfile
=
self
.
_getMatlabMexoptsPath
(
matlabVersion
)
mexoptsfile
=
self
.
_getMatlabMexoptsPath
(
matlabVersion
)
if
os
.
path
.
exists
(
mexoptsfile
)
is
not
True
:
if
os
.
path
.
exists
(
mexoptsfile
)
is
not
True
:
matlabPath
=
self
.
_getMatlabPath
(
matlabVersion
)
if
matlabPath
is
""
:
# Try ESRF Paths
matlabPath
=
self
.
_getMatlabPath
(
matlabVersion
)
self
.
_createMatlabMexopts
(
matlabPath
)
self
.
_createMatlabMexopts
(
matlabPath
)
stats
=
os
.
stat
(
mexoptsfile
)
stats
=
os
.
stat
(
mexoptsfile
)
...
@@ -177,14 +177,18 @@ class UtilsLinux(UtilsInterface):
...
@@ -177,14 +177,18 @@ class UtilsLinux(UtilsInterface):
def
_createMatlabMexopts
(
self
,
matlabPath
):
def
_createMatlabMexopts
(
self
,
matlabPath
):
cmd
=
[
os
.
path
.
join
(
matlabPath
,
"
bin
"
,
"
mex
"
),
"
-setup
"
]
cmd
=
[
os
.
path
.
join
(
matlabPath
,
"
bin
"
,
"
mex
"
),
"
-setup
"
]
subobj
=
subprocess
.
Popen
(
cmd
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
try
:
subobj
.
stdin
.
write
(
"
1
\n
"
)
subobj
=
subprocess
.
Popen
(
cmd
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
subobj
.
wait
()
subobj
.
stdin
.
write
(
"
1
\n
"
)
subobj
.
wait
()
except
OSError
as
ex
:
print
(
ex
.
args
)
raise
ValueError
(
"
Error with location: %s
\n
Check if it exists!
"
%
cmd
[
0
])
def
_getMatlabPath
(
self
,
matlabVersion
):
def
_getMatlabPath
(
self
,
matlabVersion
):
return
os
.
path
.
join
(
"
/sware
"
,
"
com
"
,
"
matlab_%s
"
%
matlabVersion
)
return
os
.
path
.
join
(
"
/sware
"
,
"
com
"
,
"
matlab_%s
"
%
matlabVersion
)
def
checkMatlabGccVersion
(
self
,
matlabVersion
):
def
checkMatlabGccVersion
(
self
,
matlabVersion
,
matlabPath
=
""
):
searchPatterns
=
[(
"
COPTIMFLAGS=
'
-O -DNDEBUG
'"
,
"
COPTIMFLAGS=
'
-O -DNDEBUG -fopenmp
'"
),
\
searchPatterns
=
[(
"
COPTIMFLAGS=
'
-O -DNDEBUG
'"
,
"
COPTIMFLAGS=
'
-O -DNDEBUG -fopenmp
'"
),
\
(
"
CXXOPTIMFLAGS=
'
-O -DNDEBUG
'"
,
"
CXXOPTIMFLAGS=
'
-O -DNDEBUG -fopenmp
'"
),
\
(
"
CXXOPTIMFLAGS=
'
-O -DNDEBUG
'"
,
"
CXXOPTIMFLAGS=
'
-O -DNDEBUG -fopenmp
'"
),
\
(
'
(CLIBS=
"
\$RPATH \$MLIBS -lm)
"'
,
'
\g<1> -fopenmp
"'
),
\
(
'
(CLIBS=
"
\$RPATH \$MLIBS -lm)
"'
,
'
\g<1> -fopenmp
"'
),
\
...
@@ -194,7 +198,10 @@ class UtilsLinux(UtilsInterface):
...
@@ -194,7 +198,10 @@ class UtilsLinux(UtilsInterface):
searchPatterns
.
append
((
"
CC=
'
gcc
'"
,
"
CC=
'
gcc44
'"
))
searchPatterns
.
append
((
"
CC=
'
gcc
'"
,
"
CC=
'
gcc44
'"
))
searchPatterns
.
append
((
"
CXX=
'
g\+\+
'"
,
"
CXX=
'
gcc44
'"
))
searchPatterns
.
append
((
"
CXX=
'
g\+\+
'"
,
"
CXX=
'
gcc44
'"
))
UtilsInterface
.
checkMatlabGccVersion
(
self
,
matlabVersion
,
searchPatterns
)
UtilsInterface
.
checkMatlabGccVersion
(
self
,
\
searchPatterns
=
searchPatterns
,
\
matlabVersion
=
matlabVersion
,
\
matlabPath
=
matlabPath
)
def
guessUserRealName
(
self
):
def
guessUserRealName
(
self
):
username
=
os
.
getenv
(
"
USER
"
)
username
=
os
.
getenv
(
"
USER
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment