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
fba34965
Commit
fba34965
authored
Aug 01, 2013
by
Paweł Szostek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetch: add --flatten and --update options
parent
4ecc0baa
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
60 additions
and
18 deletions
+60
-18
.gitignore
.gitignore
+0
-2
__main__.py
hdlmake/__main__.py
+3
-0
fetch.py
hdlmake/action/fetch.py
+9
-2
fetch_makefile.py
hdlmake/action/fetch_makefile.py
+1
-4
ise_project.py
hdlmake/action/ise_project.py
+1
-2
module.py
hdlmake/module.py
+4
-4
module_pool.py
hdlmake/module_pool.py
+41
-4
configparser.py
hdlmake/util/configparser.py
+1
-0
No files found.
.gitignore
View file @
fba34965
misc
src/build_hash.py
examples
hdlmake.aux
hdlmake.pdf
hdlmake.log
hdlmake
*~
*.swp
*.swap
...
...
hdlmake/__main__.py
View file @
fba34965
...
...
@@ -34,6 +34,9 @@ def main():
manifest_help
=
subparsers
.
add_parser
(
"manifest-help"
,
help
=
"print manifest file variables description"
)
auto
=
subparsers
.
add_parser
(
"auto"
,
help
=
"default action for hdlmake. Run when no args are given"
)
fetch
=
subparsers
.
add_parser
(
"fetch"
,
help
=
"fetch and/or update remote modules listed in Manifest"
)
fetch
.
add_argument
(
"--flatten"
,
help
=
"`flatten' modules' hierarchy by storing everything in top module's fetchto direactoru"
,
default
=
False
,
action
=
"store_true"
)
fetch
.
add_argument
(
"--update"
,
help
=
"force updating of the fetched modules"
,
default
=
False
,
action
=
"store_true"
)
clean
=
subparsers
.
add_parser
(
"clean"
,
help
=
"remove all modules fetched for this one"
)
listmod
=
subparsers
.
add_parser
(
"list-mods"
,
help
=
"List all modules together with their files"
)
listmod
.
add_argument
(
"--with-files"
,
help
=
"list modules together with their files"
,
default
=
False
,
action
=
"store_true"
,
dest
=
"withfiles"
)
...
...
hdlmake/action/fetch.py
View file @
fba34965
import
logging
import
sys
from
action
import
Action
class
FetchModules
(
Action
):
def
run
(
self
,
unfetched_only
=
False
):
def
_check_options
(
self
):
if
self
.
options
.
flatten
is
True
and
self
.
env
[
"coredir"
]
is
not
None
:
logging
.
error
(
"Options clash: --flatten and HDLMAKE_COREDIR set at a time
\n
"
"Take one out of the two"
)
sys
.
exit
(
"
\n
Exiting"
)
def
run
(
self
):
logging
.
info
(
"Fetching needed modules."
)
self
.
modules_pool
.
fetch_all
(
unfetched_only
)
self
.
modules_pool
.
fetch_all
(
unfetched_only
=
not
self
.
options
.
update
,
flatten
=
self
.
options
.
flatten
)
logging
.
debug
(
str
(
self
.
modules_pool
))
hdlmake/action/fetch_makefile.py
View file @
fba34965
...
...
@@ -11,8 +11,5 @@ class GenerateFetchMakefile(Action):
"No fetch makefile is produced"
)
quit
()
if
not
pool
.
is_everything_fetched
():
logging
.
error
(
"A module remains unfetched. "
"Fetching must be done prior to makefile generation"
)
quit
()
self
.
_check_all_fetched_or_quit
()
self
.
make_writer
.
generate_fetch_makefile
(
pool
)
hdlmake/action/ise_project.py
View file @
fba34965
...
...
@@ -35,9 +35,8 @@ class GenerateISEProject(Action):
logging
.
info
(
"Generating project for ISE v.
%
s.
%
s"
%
(
env
[
"ise_version"
][
0
],
env
[
"ise_version"
][
1
]))
def
run
(
self
):
self
.
_check_all_fetched_or_quit
()
logging
.
info
(
"Generating/updating ISE project file."
)
if
os
.
path
.
exists
(
self
.
top_module
.
syn_project
)
or
os
.
path
.
exists
(
self
.
top_module
.
syn_project
+
".xise"
):
self
.
_handle_ise_project
(
update
=
True
)
else
:
...
...
hdlmake/module.py
View file @
fba34965
...
...
@@ -100,7 +100,7 @@ class Module(object):
self
.
isfetched
=
False
if
self
.
path
is
not
None
:
self
.
manifest
=
self
.
_
_
search_for_manifest
()
self
.
manifest
=
self
.
_search_for_manifest
()
else
:
self
.
manifest
=
None
...
...
@@ -120,7 +120,7 @@ class Module(object):
return
__nonull
(
self
.
local
)
+
__nonull
(
self
.
git
)
+
__nonull
(
self
.
svn
)
def
_
_
search_for_manifest
(
self
):
def
_search_for_manifest
(
self
):
"""
Look for manifest in the given folder
"""
...
...
@@ -128,7 +128,7 @@ class Module(object):
dir_files
=
os
.
listdir
(
self
.
path
)
if
"manifest.py"
in
dir_files
and
"Manifest.py"
in
dir_files
:
logging
.
error
(
"Both manifest.py and Manifest.py found in the module directory:
%
s"
%
self
.
path
)
quit
(
)
sys
.
exit
(
"
\n
Exiting"
)
for
filename
in
dir_files
:
if
filename
==
"manifest.py"
or
filename
==
"Manifest.py"
:
if
not
os
.
path
.
isdir
(
filename
):
...
...
@@ -169,7 +169,7 @@ class Module(object):
if
self
.
isparsed
is
True
or
self
.
isfetched
is
False
:
return
if
self
.
manifest
is
None
:
self
.
manifest
=
self
.
_
_
search_for_manifest
()
self
.
manifest
=
self
.
_search_for_manifest
()
if
self
.
path
is
None
:
raise
RuntimeError
()
...
...
hdlmake/module_pool.py
View file @
fba34965
...
...
@@ -28,6 +28,7 @@ import dep_solver
from
srcfile
import
SourceFileSet
from
fetch
import
BackendFactory
import
fetch
from
subprocess
import
PIPE
,
Popen
class
ModulePool
(
list
):
...
...
@@ -72,13 +73,27 @@ class ModulePool(list):
def
new_module
(
self
,
parent
,
url
,
source
,
fetchto
,
process_manifest
=
True
):
from
module
import
Module
if
url
in
[
m
.
url
for
m
in
self
]:
# check if module is not already in the pool
if
source
!=
"local"
:
clean_url
,
branch
,
revision
=
path
.
parse_url
(
url
)
else
:
clean_url
,
branch
,
revision
=
url
,
None
,
None
if
clean_url
in
[
m
.
url
for
m
in
self
]:
# check if module is not already in the pool
same_url_mod
=
[
m
for
m
in
self
if
m
.
url
==
url
][
0
]
if
branch
!=
same_url_mod
.
branch
:
logging
.
error
(
"Requested the same module, but different branches."
"URL:
%
s
\n
"
%
clean_url
+
"branches:
%
s and
%
s
\n
"
%
(
branch
,
same_url_mod
.
branch
))
sys
.
exit
(
"
\n
Exiting"
)
if
revision
!=
same_url_mod
.
revision
:
logging
.
error
(
"Requested the same module, but different revisions."
"URL:
%
s
\n
"
%
clean_url
+
"revisions:
%
s and
%
s
\n
"
%
(
revision
,
same_url_mod
.
revision
))
sys
.
exit
(
"
\n
Exiting"
)
return
[
m
for
m
in
self
if
m
.
url
==
url
][
0
]
else
:
if
self
.
global_fetch
:
# if there is global fetch parameter (HDLMAKE_COREDIR env variable)
fetchto
=
self
.
global_fetch
# screw module's particular fetchto
elif
global_mod
.
top_module
:
fetchto
=
global_mod
.
top_module
.
fetchto
new_module
=
Module
(
parent
=
parent
,
url
=
url
,
source
=
source
,
fetchto
=
fetchto
,
pool
=
self
)
self
.
_add
(
new_module
)
...
...
@@ -91,8 +106,28 @@ class ModulePool(list):
return
new_module
def
process_top_module_manifest
(
self
):
url
=
self
.
_guess_origin
(
global_mod
.
top_module
.
path
)
if
url
:
global_mod
.
top_module
.
url
=
url
global_mod
.
top_module
.
process_manifest
()
def
_guess_origin
(
self
,
path
):
cwd
=
os
.
getcwd
()
try
:
os
.
chdir
(
path
)
git_out
=
Popen
(
"git config --get remote.origin.url"
,
stdout
=
PIPE
,
shell
=
True
,
close_fds
=
True
)
url
=
git_out
.
stdout
.
readlines
()[
0
]
.
strip
()
if
not
url
:
# try svn
svn_out
=
Popen
(
"svn info | grep 'Repository Root' | awk '{print $NF}'"
,
stdout
=
PIPE
,
shell
=
True
,
close_fds
=
True
)
url
=
svn_out
.
stdout
.
readlines
()[
0
]
.
strip
()
if
url
:
return
url
else
:
return
None
else
:
return
url
finally
:
os
.
chdir
(
cwd
)
def
_add
(
self
,
new_module
):
from
module
import
Module
if
not
isinstance
(
new_module
,
Module
):
...
...
@@ -105,11 +140,13 @@ class ModulePool(list):
self
.
append
(
new_module
)
return
True
def
fetch_all
(
self
,
unfetched_only
=
False
):
def
fetch_all
(
self
,
unfetched_only
=
False
,
flatten
=
False
):
fetch_queue
=
[
m
for
m
in
self
]
while
len
(
fetch_queue
)
>
0
:
cur_mod
=
fetch_queue
.
pop
()
if
flatten
is
True
:
cur_mod
.
fetchto
=
global_mod
.
top_module
.
fetchto
new_modules
=
[]
if
unfetched_only
:
if
cur_mod
.
isfetched
:
...
...
hdlmake/util/configparser.py
View file @
fba34965
...
...
@@ -283,6 +283,7 @@ class ConfigParser(object):
quit
()
except
:
logging
.
error
(
"Encountered unexpected error while parsing "
+
self
.
config_file
)
logging
.
error
(
content
)
print
(
str
(
sys
.
exc_info
()[
0
])
+
':'
+
str
(
sys
.
exc_info
()[
1
]))
raise
...
...
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