Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
2db9c7bf
Commit
2db9c7bf
authored
Sep 19, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell: Split check_windows.
THere is now check_windows_tools and check_windows_commands.
parent
e9b5dc57
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
29 deletions
+34
-29
git.py
hdlmake/fetch/git.py
+1
-1
main.py
hdlmake/main.py
+1
-1
ise.py
hdlmake/tools/ise.py
+2
-2
isim.py
hdlmake/tools/isim.py
+1
-1
make_syn.py
hdlmake/tools/make_syn.py
+4
-4
makefile.py
hdlmake/tools/makefile.py
+3
-3
shell.py
hdlmake/util/shell.py
+15
-13
test_all.py
testsuite/test_all.py
+7
-4
No files found.
hdlmake/fetch/git.py
View file @
2db9c7bf
...
...
@@ -119,7 +119,7 @@ class Git(Fetcher):
config_content
=
Popen
(
"git config -f .gitmodules --list"
,
stdout
=
PIPE
,
stdin
=
PIPE
,
close_fds
=
not
shell
.
check_windows
(),
close_fds
=
not
shell
.
check_windows
_tools
(),
shell
=
True
)
config_lines
=
[
line
.
strip
()
.
decode
(
'utf-8'
)
for
line
in
config_content
.
stdout
.
readlines
()]
...
...
hdlmake/main.py
View file @
2db9c7bf
...
...
@@ -172,7 +172,7 @@ def set_logging_level(options):
if
not
isinstance
(
numeric_level
,
int
):
raise
Exception
(
'Invalid log level:
%
s'
%
options
.
log
)
if
not
shell
.
check_windows
()
and
options
.
logfile
==
None
:
if
not
shell
.
check_windows
_tools
()
and
options
.
logfile
==
None
:
logging
.
basicConfig
(
format
=
colored
(
"
%(levelname)
s"
,
...
...
hdlmake/tools/ise.py
View file @
2db9c7bf
...
...
@@ -118,7 +118,7 @@ $(TCL_CLOSE)'''
'translate'
:
_ISE_RUN
.
format
(
"Translate"
),
'map'
:
_ISE_RUN
.
format
(
"Map"
),
'par'
:
_ISE_RUN
.
format
(
"Place "
+
(
"^&"
if
shell
.
check_windows
()
else
"'&'"
)
+
(
"^&"
if
shell
.
check_windows
_tools
()
else
"'&'"
)
+
" Route"
),
'bitstream'
:
_ISE_RUN
.
format
(
"Generate Programming File"
),
'install_source'
:
"*.bit *.bin"
}
...
...
@@ -151,7 +151,7 @@ $(TCL_CLOSE)'''
syn_properties
=
self
.
manifest_dict
.
get
(
"syn_properties"
)
project_new
=
[]
project_tcl
=
self
.
_tcl_controls
[
"project"
]
if
shell
.
check_windows
():
if
shell
.
check_windows
_commands
():
tmp
=
'project set "{0}" "{1}"'
else
:
tmp
=
'project set
\\
"{0}
\\
"
\\
"{1}
\\
"'
...
...
hdlmake/tools/isim.py
View file @
2db9c7bf
...
...
@@ -74,7 +74,7 @@ class ToolISim(MakeSim):
xilinx_dir
=
str
(
os
.
path
.
join
(
self
.
manifest_dict
[
"sim_path"
],
".."
,
".."
))
hdl_language
=
'vhdl'
# 'verilog'
if
shell
.
check_windows
():
if
shell
.
check_windows
_tools
():
os_prefix
=
'nt'
else
:
os_prefix
=
'lin'
...
...
hdlmake/tools/make_syn.py
View file @
2db9c7bf
...
...
@@ -48,7 +48,7 @@ class MakeSyn(ToolMakefile):
def
_makefile_syn_top
(
self
):
"""Create the top part of the synthesis Makefile"""
if
shell
.
check_windows
():
if
shell
.
check_windows
_tools
():
tcl_interpreter
=
self
.
_tool_info
[
"windows_bin"
]
else
:
tcl_interpreter
=
self
.
_tool_info
[
"linux_bin"
]
...
...
@@ -125,14 +125,14 @@ endif""")
for
command
in
self
.
_tcl_controls
[
"files"
]
.
split
(
'
\n
'
):
tcl_command
.
append
(
echo_command
.
format
(
command
))
command_string
=
"
\n
"
.
join
(
tcl_command
)
if
shell
.
check_windows
():
if
shell
.
check_windows
_commands
():
command_string
=
command_string
.
replace
(
"'"
,
""
)
self
.
writeln
(
command_string
)
for
filetype
in
sources_list
:
filetype_string
=
(
'
\t\t
@$(foreach sourcefile,'
' $(SOURCES_{0}), echo "{1}" >> $@ &)'
.
format
(
filetype
.
__name__
,
fileset_dict
[
filetype
]))
if
shell
.
check_windows
():
if
shell
.
check_windows
_commands
():
filetype_string
=
filetype_string
.
replace
(
'"'
,
''
)
self
.
writeln
(
filetype_string
)
...
...
@@ -155,7 +155,7 @@ endif""")
for
command
in
self
.
_tcl_controls
[
stage
]
.
split
(
'
\n
'
):
tcl_command
.
append
(
echo_command
.
format
(
command
))
command_string
=
"
\n
"
.
join
(
tcl_command
)
if
shell
.
check_windows
():
if
shell
.
check_windows
_commands
():
command_string
=
command_string
.
replace
(
"'"
,
""
)
self
.
writeln
(
"""
\
...
...
hdlmake/tools/makefile.py
View file @
2db9c7bf
...
...
@@ -74,7 +74,7 @@ class ToolMakefile(object):
def
_get_name_bin
(
self
):
"""Get the name and binary values"""
if
shell
.
check_windows
():
if
shell
.
check_windows
_tools
():
bin_name
=
self
.
_tool_info
[
'windows_bin'
]
else
:
bin_name
=
self
.
_tool_info
[
'linux_bin'
]
...
...
@@ -137,7 +137,7 @@ class ToolMakefile(object):
self
.
writeln
(
"clean:"
)
tmp
=
"
\t\t
"
+
shell
.
del_command
()
+
" $(CLEAN_TARGETS)"
self
.
writeln
(
tmp
)
if
shell
.
check_windows
():
if
shell
.
check_windows
_commands
():
tmp
=
"
\t\t
@-"
+
shell
.
rmdir_command
()
+
\
" $(CLEAN_TARGETS) >nul 2>&1"
self
.
writeln
(
tmp
)
...
...
@@ -170,7 +170,7 @@ class ToolMakefile(object):
if
not
self
.
_initialized
:
self
.
_initialized
=
True
self
.
initialize
()
if
shell
.
check_windows
():
if
shell
.
check_windows
_commands
():
self
.
_file
.
write
(
line
.
replace
(
'
\\
"'
,
'"'
))
else
:
self
.
_file
.
write
(
line
)
...
...
hdlmake/util/shell.py
View file @
2db9c7bf
...
...
@@ -39,7 +39,7 @@ def run(command):
stdout
=
PIPE
,
stdin
=
PIPE
,
stderr
=
PIPE
,
close_fds
=
not
check_windows
(),
close_fds
=
not
check_windows
_tools
(),
# FIXME: comment
shell
=
True
)
lines
=
command_out
.
stdout
.
readlines
()
if
len
(
lines
)
==
0
:
...
...
@@ -56,17 +56,19 @@ def tclpath(path):
return
path
.
replace
(
slash_char
(),
"/"
)
def
check_windows
():
"""Check if we are operating on a Windows filesystem"""
if
platform
.
system
()
==
'Windows'
or
sys
.
platform
==
'cygwin'
:
return
True
else
:
return
False
def
check_windows_tools
():
"""Check if we are using windows version of synthesis/simulation tools"""
return
platform
.
system
()
==
'Windows'
or
sys
.
platform
==
'cygwin'
def
check_windows_commands
():
"""Check if we are using windows commands (del/type).
False on cygwin"""
return
platform
.
system
()
==
'Windows'
def
del_command
():
"""Get a string with the O.S. specific delete command"""
if
check_windows
():
if
check_windows
_commands
():
return
"del /s /q /f"
else
:
return
"rm -rf"
...
...
@@ -74,7 +76,7 @@ def del_command():
def
rmdir_command
():
"""Get a string with the O.S. specific remove directory command"""
if
check_windows
():
if
check_windows
_commands
():
return
"rmdir /s /q"
else
:
return
"rm -rf"
...
...
@@ -82,7 +84,7 @@ def rmdir_command():
def
copy_command
():
"""Get a string with the O.S. specific copy command"""
if
check_windows
():
if
check_windows
_commands
():
return
"copy"
else
:
return
"cp"
...
...
@@ -90,7 +92,7 @@ def copy_command():
def
mkdir_command
():
"""Get a string with the O.S. specific mkdir command"""
if
check_windows
():
if
check_windows
_commands
():
return
"mkdir"
else
:
return
"mkdir -p"
...
...
@@ -98,7 +100,7 @@ def mkdir_command():
def
touch_command
():
"""Get a string with the O.S. specific mkdir command"""
if
check_windows
():
if
check_windows
_commands
():
return
"type nul >>"
else
:
return
"touch"
...
...
@@ -117,7 +119,7 @@ def which(filename):
def
slash_char
():
"""Get a string with the O.S. specific path separator"""
if
check_windows
():
if
check_windows
_tools
():
return
"
\\
"
else
:
return
"/"
...
...
testsuite/test_all.py
View file @
2db9c7bf
...
...
@@ -12,7 +12,8 @@ class Config(object):
def
__init__
(
self
,
path
=
None
,
check_windows
=
False
,
fakebin
=
"linux_fakebin"
):
self
.
path
=
path
self
.
prev_env_path
=
os
.
environ
[
'PATH'
]
self
.
prev_check_windows
=
hdlmake
.
util
.
shell
.
check_windows
self
.
prev_check_windows_commands
=
hdlmake
.
util
.
shell
.
check_windows_commands
self
.
prev_check_windows_tools
=
hdlmake
.
util
.
shell
.
check_windows_tools
self
.
check_windows
=
check_windows
self
.
fakebin
=
fakebin
...
...
@@ -22,13 +23,15 @@ class Config(object):
+
self
.
prev_env_path
)
if
self
.
path
is
not
None
:
os
.
chdir
(
self
.
path
)
hdlmake
.
util
.
shell
.
check_windows
=
(
lambda
:
self
.
check_windows
)
hdlmake
.
util
.
shell
.
check_windows_tools
=
(
lambda
:
self
.
check_windows
)
hdlmake
.
util
.
shell
.
check_windows_commands
=
(
lambda
:
self
.
check_windows
)
def
__exit__
(
self
,
*
_
):
if
self
.
path
is
not
None
:
os
.
chdir
(
".."
)
os
.
environ
[
'PATH'
]
=
self
.
prev_env_path
hdlmake
.
util
.
shell
.
check_windows
=
self
.
prev_check_windows
hdlmake
.
util
.
shell
.
check_windows_tools
=
self
.
prev_check_windows_tools
hdlmake
.
util
.
shell
.
check_windows_commands
=
self
.
prev_check_windows_commands
def
compare_makefile
():
ref
=
open
(
'Makefile.ref'
,
'r'
)
.
read
()
...
...
@@ -399,7 +402,7 @@ def test_dep_level():
run
([
'list-files'
,
'--top'
,
'level2'
],
path
=
"053vlog_dep_level"
)
def
test_modelsim_windows
():
assert
hdlmake
.
util
.
shell
.
check_windows
()
is
False
assert
hdlmake
.
util
.
shell
.
check_windows
_tools
()
is
False
run_compare
(
path
=
"057msim_windows"
,
check_windows
=
True
)
def
test_nosim_tool
():
...
...
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