Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hdlmake
Manage
Activity
Members
Labels
Plan
Issues
20
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Projects
Hdlmake
Commits
634fb872
Commit
634fb872
authored
11 years ago
by
Paweł Szostek
Browse files
Options
Downloads
Patches
Plain Diff
add initial enironmental checker
parent
f6870d3d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/__main__.py
+0
-1
0 additions, 1 deletion
src/__main__.py
src/env_checker.py
+123
-0
123 additions, 0 deletions
src/env_checker.py
test/Manifest.py
+1
-0
1 addition, 0 deletions
test/Manifest.py
with
124 additions
and
1 deletion
src/__main__.py
+
0
−
1
View file @
634fb872
...
...
@@ -175,7 +175,6 @@ def main():
if
is_set
:
sth_chosen
=
True
getattr
(
kernel
,
function
)()
sth_chosen
=
False
except
Exception
,
unknown_error
:
p
.
echo
(
"
Oooops! We
'
ve got an error. Here is the appropriate info:
\n
"
)
p
.
print_version
()
...
...
This diff is collapsed.
Click to expand it.
src/env_checker.py
0 → 100644
+
123
−
0
View file @
634fb872
#!/usr/bin/python
# -*- coding: utf-8 -*-
import
os
import
sys
class
EnvChecker
(
dict
):
def
__init__
(
self
,
options
,
manifest
):
self
.
options
=
options
self
.
manifest
=
manifest
def
check
(
self
):
platform
=
sys
.
platform
print
(
"
Plartform: %s
"
%
platform
)
xilinx
=
os
.
environ
(
"
XILINX
"
)
if
val
:
print
(
"
Environmental variable %s is set: %s.
"
%
(
"
XILINX
"
,
xilinx
))
self
[
"
xilinx
"
]
=
xilinx
else
:
print
(
"
Environmental variable XILINX is not set.
"
)
ise_version
=
self
.
_guess_ise_version
()
top_module
=
self
.
report_and_set_var
(
"
TOP_MODULE
"
)
self
.
report_in_patH
(
"
ise
"
)
self
.
report_in_path
(
"
isim
"
)
self
.
report_and_set_var
(
"
ISE_PATH
"
)
self
.
report_in_path
(
"
vsim
"
)
self
.
report_and_set_var
(
"
MODELSIM_PATH
"
)
self
.
report_in_path
(
"
iverilog
"
)
self
.
report_and_set_var
(
"
RSYNTH_USER
"
)
self
.
report_and_set_var
(
"
RSYNTH_ISE_PATH
"
)
self
.
report_and_set_var
(
"
RSYNTH_USE_SCREEN
"
)
def
check_modelsim_ini
(
self
):
pass
def
check_xilinxsim_init
(
self
):
pass
def
_check_ise_version
(
self
,
xilinx
,
ise_path
):
import
subprocess
import
re
xst
=
subprocess
.
Popen
(
'
which xst
'
,
shell
=
True
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
close_fds
=
True
)
lines
=
xst
.
stdout
.
readlines
()
if
not
lines
:
p
.
error
(
"
Xilinx binaries are not in the PATH variable
\n
"
"
Can
'
t determine ISE version
"
)
quit
()
xst
=
str
(
lines
[
0
].
strip
())
version_pattern
=
re
.
compile
(
"
.*?(\d\d\.\d).*
"
)
#First check if we have version in path
match
=
re
.
match
(
version_pattern
,
xst
)
if
match
:
ise_version
=
match
.
group
(
1
)
else
:
#If it is not the case call the "xst -h" to get version
xst_output
=
subprocess
.
Popen
(
'
xst -h
'
,
shell
=
True
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
close_fds
=
True
)
xst_output
=
xst_output
.
stdout
.
readlines
()[
0
]
xst_output
=
xst_output
.
strip
()
version_pattern
=
\
re
.
compile
(
'
Release\s(?P<major>\d|\d\d)[^\d](?P<minor>\d|\d\d)\s.*
'
)
match
=
re
.
match
(
version_pattern
,
xst_output
)
if
match
:
ise_version
=
''
.
join
((
match
.
group
(
'
major
'
),
'
.
'
,
match
.
group
(
'
minor
'
)))
else
:
p
.
error
(
"
xst output is not in expected format:
"
+
xst_output
+
"
\n
"
"
Can
'
t determine ISE version
"
)
return
None
p
.
vprint
(
"
ISE version:
"
+
ise_version
)
return
ise_version
def
__figure_out_ise_path
(
self
):
if
self
.
options
.
force_ise
is
not
None
:
if
self
.
options
.
force_ise
==
0
:
ise
=
self
.
__check_ise_version
()
else
:
ise
=
self
.
options
.
force_ise
else
:
ise
=
0
try
:
ise_path
=
path
.
ise_path_32
[
str
(
ise
)]
+
'
/
'
except
KeyError
:
if
ise
!=
0
:
ise_path
=
"
/opt/Xilinx/
"
+
str
(
ise
)
+
"
/ISE_DS/ISE/bin/lin/
"
else
:
ise_path
=
""
return
ise_path
def
_get
(
self
,
name
):
assert
not
name
.
startswith
(
"
HDLMAKE_
"
)
assert
isinstance
(
name
,
basestring
)
return
os
.
environ
(
"
HDLMAKE_%s
"
%
name
)
def
get_path
(
self
,
name
):
return
os
.
popen
(
"
which %s
"
%
name
).
read
().
strip
()
def
check_in_path
(
self
,
name
):
assert
isinstance
(
name
,
basestring
)
path
=
self
.
get_path
(
name
)
return
len
(
path
)
>
0
def
report_in_path
(
self
,
name
):
path
=
self
.
get_path
(
name
)
if
path
:
print
(
"
%s is in PATH: %s.
"
%
(
name
,
path
))
else
:
print
(
"
%s is not in PATH.
"
%
path
)
def
report_and_set_var
(
self
,
name
):
val
=
os
.
environ
(
"
HDLMAKE_%s
"
%
name
)
if
val
:
print
(
"
Environmental variable %s is set: %s.
"
%
(
name
,
val
))
self
[
name
.
lower
()]
=
val
else
:
print
(
"
Environmental variable %s is not set.
"
%
name
)
This diff is collapsed.
Click to expand it.
test/Manifest.py
+
1
−
0
View file @
634fb872
action
=
"
simulation
"
target
=
"
xilinx
"
use_compiler
=
"
isim
"
files
=
[
"
top_module_tb.vhd
"
,
"
top_module.vhd
"
]
This diff is collapsed.
Click to expand it.
Preview
0%
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