Commit ded989dc authored by Tristan Gingold's avatar Tristan Gingold

Add --cygwin/--windows options.

parent 1bafa174
......@@ -35,6 +35,7 @@ from hdlmake.fetch.svn import Svn
from hdlmake.fetch.git import Git, GitSM
from hdlmake.fetch.local import Local
from .action import Action
import hdlmake.util.shell as shell
class ActionCore(Action):
......@@ -61,6 +62,9 @@ class ActionCore(Action):
def makefile(self):
"""Write the Makefile for the current design"""
commands = self.options.__dict__.get('make')
if commands:
shell.set_commands_os(commands)
self._check_all_fetched()
self.build_file_set()
self.solve_file_set()
......
......@@ -113,6 +113,15 @@ def _get_parser():
makefile.add_argument(
"-f", "--filename", default=None, dest="filename",
help="name for the Makefile file to be created")
makefile.add_argument(
"--make", default='auto', dest='make', choices=['auto', 'cygwin', 'windows'],
help="select the type of 'make' on windows platforms")
makefile.add_argument(
"--cygwin", action='store_const', dest='make', const='cygwin',
help="select a cygwin 'make' on windows platforms")
makefile.add_argument(
"--windows", action='store_const', dest='make', const='windows',
help="select a mingw/windows 'make' on windows platforms")
subparsers.add_parser(
"fetch",
......
......@@ -31,6 +31,17 @@ import logging
from subprocess import PIPE, Popen, CalledProcessError
commands_os = 'auto'
def set_commands_os(name):
"""Select the OS for commands"""
global commands_os
if name == 'windows' and not check_windows_tools():
logging.warning("Setting 'make' to windows may not work on non-windows platforms")
commands_os = name
def run(command):
"""Execute a command in the shell and print the output lines as a list"""
try:
......@@ -63,7 +74,10 @@ def check_windows_tools():
def check_windows_commands():
"""Check if we are using windows commands (del/type).
False on cygwin"""
return platform.system() == 'Windows'
if commands_os == 'auto':
return platform.system() == 'Windows'
else:
return commands_os == 'windows'
def del_command():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment