From d3a7430577187f9657e67c14a8603f2ec260bdab Mon Sep 17 00:00:00 2001 From: "I. Pinakoulakis" Date: Wed, 6 Jan 2016 20:19:41 +0100 Subject: [PATCH 1/2] Added 2 more directories to search for Arduino (for new Mac OS X users and Cask users. Added fix to exclude src and examples from lib flags in make --- ino/commands/build.py | 6 +++--- ino/environment.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ino/commands/build.py b/ino/commands/build.py index 65a9f8e..3fa5a76 100644 --- a/ino/commands/build.py +++ b/ino/commands/build.py @@ -163,7 +163,7 @@ def setup_flags(self, args): self.e['cppflags'].append('-DUSB_VID=%s' % board['build']['vid']) if 'pid' in board['build']: self.e['cppflags'].append('-DUSB_PID=%s' % board['build']['pid']) - + if self.e.arduino_lib_version.major: variant_dir = os.path.join(self.e.arduino_variants_dir, board['build']['variant']) @@ -221,7 +221,7 @@ def recursive_inc_lib_flags(self, libdirs): flags = SpaceList() for d in libdirs: flags.append('-I' + d) - flags.extend('-I' + subd for subd in list_subdirs(d, recursive=True, exclude=['examples'])) + flags.extend('-I' + subd for subd in list_subdirs(d, recursive=True, exclude=['examples', 'src'])) return flags def _scan_dependencies(self, dir, lib_dirs, inc_flags): @@ -252,7 +252,7 @@ def scan_dependencies(self): # If lib A depends on lib B it have to appear before B in final # list so that linker could link all together correctly # but order of `_scan_dependencies` is not defined, so... - + # 1. Get dependencies of sources in arbitrary order used_libs = list(self._scan_dependencies(self.e.src_dir, lib_dirs, inc_flags)) diff --git a/ino/environment.py b/ino/environment.py index 8cb27e8..2b81b8e 100644 --- a/ino/environment.py +++ b/ino/environment.py @@ -79,7 +79,9 @@ class Environment(dict): ] if platform.system() == 'Darwin': + arduino_dist_dir_guesees.insert(0, '/Applications/Artisteer.app/Contents/Java') arduino_dist_dir_guesses.insert(0, '/Applications/Arduino.app/Contents/Resources/Java') + arduino_dist_dir_guesses.insert(0, '~/Applications/Arduino.app/Contents/Java') default_board_model = 'uno' ino = sys.argv[0] From 61a19bc5e57a4fff53f94efe80adb8c385704376 Mon Sep 17 00:00:00 2001 From: "I. Pinakoulakis" Date: Wed, 6 Jan 2016 20:34:38 +0100 Subject: [PATCH 2/2] Final fix for reading the correct. Updated the doc. Updated the changelog --- README.rst | 4 ++++ ino/argparsing.py | 6 +++--- ino/environment.py | 11 +++++++---- ino/runner.py | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index b7fb205..3ef56d8 100644 --- a/README.rst +++ b/README.rst @@ -96,6 +96,10 @@ Contributors Changelog ========= +0.3.7 + * Fixed issue with new Mac OS X and Homebrew Cask Arduino installations. + * Excluded `src` from the lib flags in the used by `Makefile`. + 0.3.6 * Fix #74, #107, #108: Use of types declared in included files is allowed in function definitions. Previously it led to: '' not diff --git a/ino/argparsing.py b/ino/argparsing.py index 20b7cdb..3a1b9c2 100644 --- a/ino/argparsing.py +++ b/ino/argparsing.py @@ -65,7 +65,7 @@ def _split_lines(self, text, width): sub_indent = indent + len(list_match.group(2)) else: sub_indent = indent - + # Textwrap will do all the hard work for us line = self._whitespace_matcher.sub(' ', line).strip() new_lines = textwrap.wrap( @@ -74,7 +74,7 @@ def _split_lines(self, text, width): initial_indent=' '*(indent-main_indent), subsequent_indent=' '*(sub_indent-main_indent), ) - + # Blank lines get eaten by textwrap, put it back with [' '] lines.extend(new_lines or [' ']) @@ -93,7 +93,7 @@ def _split_lines(self, text, width): You must use backslashes at the end of lines to indicate that you\ want the text to wrap instead of preserving the newline. - + As with docstrings, the leading space to the text block is ignored. ''') parser.parse_args(['-h']) diff --git a/ino/environment.py b/ino/environment.py index 2b81b8e..2a89738 100644 --- a/ino/environment.py +++ b/ino/environment.py @@ -79,9 +79,12 @@ class Environment(dict): ] if platform.system() == 'Darwin': - arduino_dist_dir_guesees.insert(0, '/Applications/Artisteer.app/Contents/Java') - arduino_dist_dir_guesses.insert(0, '/Applications/Arduino.app/Contents/Resources/Java') - arduino_dist_dir_guesses.insert(0, '~/Applications/Arduino.app/Contents/Java') + if os.path.exists('/Applications/Arduino.app/Contents/Java'): + arduino_dist_dir_guesees.insert(0, '/Applications/Arduino.app/Contents/Java') + elif os.path.exists('/Users/' + os.environ['USER'] + '/Applications/Arduino.app/Contents/Java'): + arduino_dist_dir_guesses.insert(0, '/Users/' + os.environ['USER'] + '/Applications/Arduino.app/Contents/Java') + else: + arduino_dist_dir_guesses.insert(0, '/Applications/Arduino.app/Contents/Resources/Java') default_board_model = 'uno' ino = sys.argv[0] @@ -148,7 +151,7 @@ def _find(self, key, items, places, human_name, join, multi): places = map(os.path.expanduser, places) glob_places = itertools.chain.from_iterable(glob(p) for p in places) - + print 'Searching for', human_name, '...', results = [] for p in glob_places: diff --git a/ino/runner.py b/ino/runner.py index f94a1df..ed9c52a 100644 --- a/ino/runner.py +++ b/ino/runner.py @@ -65,7 +65,7 @@ def main(): if current_command not in run_anywhere: # For valid projects create .build & lib - if not os.path.isdir(e.build_dir): + if not os.path.isdir(e.build_dir): os.makedirs(e.build_dir) if not os.path.isdir(e.lib_dir):