Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Commit 84d29c5

Browse files
James CrosbyJames Crosby
James Crosby
authored and
James Crosby
committed
various fixes:
* improve setup.py * improve debug program path suggestions * fix target error message * expand environment variables when executing debug commands
1 parent 520bb46 commit 84d29c5

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import os
2-
from setuptools import setup
2+
from setuptools import setup, find_packages
33

44
# Utility function to cat in a file (used for the README)
55
def read(fname):
66
return open(os.path.join(os.path.dirname(__file__), fname)).read()
77

88
setup(
99
name = "yotta",
10-
version = "0.0.12",
10+
version = "0.0.13",
1111
author = "James Crosby",
1212
author_email = "James.Crosby@arm.com",
1313
description = ("Re-usable components for embedded software."),
1414
license = "Proprietary",
1515
keywords = "embedded package module dependency management",
1616
url = "about:blank",
17-
packages=['yotta', os.path.join('yotta','lib')],
17+
packages=find_packages(),
1818
long_description=read('readme.md'),
1919
classifiers=[
2020
"Development Status :: 3 - Alpha",

yotta/lib/target.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,17 @@ def debug(self, builddir, program):
129129
return
130130
prog_path = os.path.join(builddir, program)
131131
if not os.path.isfile(prog_path):
132-
suggestion = ''
133-
if prog_path.endswith('.c'):
134-
suggestion = prog_path[:-2]
132+
suggestion = None
133+
if (prog_path.endswith('.c') or prog_path.endswith('.m')) and os.path.isfile(prog_path[:-2]):
134+
suggestion = program[:-2]
135+
elif (prog_path.endswith('.cpp') or prog_path.endswith('.cxx')) and os.path.isfile(prog_path[:-4]):
136+
suggestion = program[:-4]
137+
elif os.path.isfile(os.path.join(builddir, 'source', program)):
138+
suggestion = os.path.join('source', program)
139+
if suggestion is not None:
140+
yield "%s does not exist, perhaps you meant %s" % (program, suggestion)
135141
else:
136-
suggestion = os.path.relpath(program), os.path.relpath(os.path.join('source', program))
137-
yield "%s does not exist, perhaps you meant %s" % suggestion
142+
yield "%s does not exist" % program
138143
return
139144

140145

@@ -145,21 +150,24 @@ def debug(self, builddir, program):
145150
if 'debug-server' in self.description:
146151
logging.debug('starting debug server...')
147152
daemon = subprocess.Popen(
148-
self.description['debug-server'], cwd=builddir,
149-
stdout=dev_null, stderr=dev_null, preexec_fn=_newPGroup
153+
self.description['debug-server'],
154+
cwd = builddir,
155+
stdout = dev_null,
156+
stderr = dev_null,
157+
preexec_fn = _newPGroup
150158
)
151159
else:
152160
daemon = None
153161

154162

155163
signal.signal(signal.SIGINT, _ignoreSignal);
156164
cmd = [
157-
string.Template(x).safe_substitute(program=prog_path)
165+
os.path.expandvars(string.Template(x).safe_substitute(program=prog_path))
158166
for x in self.description['debug']
159167
]
160168
logging.debug('starting debugger: %s', cmd)
161169
child = subprocess.Popen(
162-
cmd, cwd=builddir
170+
cmd, cwd = builddir
163171
)
164172
child.wait()
165173
if child.returncode:

yotta/target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def execCommand(args):
4141
print None
4242
else:
4343
if not Target_RE.match(args.target):
44-
logging.error('''Invalid target: "%s"''')#, targets must be one of:
44+
logging.error('''Invalid target: "%s"''' % args.target)#, targets must be one of:
4545
#
4646
# a valid name (lowercase letters, numbers, and hyphen)
4747
# a github ref (owner/project)

0 commit comments

Comments
 (0)