Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.do files of the form do/a.do were not found #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def _default_do_files(filename):
def _possible_do_files(t):
dirname,filename = os.path.split(t)
yield (dirname, "%s.do" % filename, '', filename, '')
yield (dirname, "%s.do" % filename, '', filename, '')

# It's important to try every possibility in a directory before resorting
# to a parent directory. Think about nested projects: I don't want
Expand All @@ -26,8 +25,7 @@ def _possible_do_files(t):
# for building my project in *all* cases.
dirbits = os.path.abspath(dirname).split('/')
for i in range(len(dirbits), -1, -1):
basedir = os.path.join(dirname,
join('/', ['..'] * (len(dirbits) - i)))
basedir = os.path.join(dirname, *['..'] * (len(dirbits) - i))
subdir = join('/', dirbits[i:])
for dofile,basename,ext in _default_do_files(filename):
yield (basedir, dofile,
Expand All @@ -36,7 +34,7 @@ def _possible_do_files(t):
def _possible_do_files_in_do_dir(t):
for dodir,dofile,basedir,basename,ext in _possible_do_files(t):
yield (dodir,dofile,basedir,basename,ext)
yield (dodir+"/do", dofile, "../"+basedir, basename, ext)
yield (os.path.join(dodir, "do"), dofile, "../"+basedir, basename, ext)

def _find_do_file(f):
for dodir,dofile,basedir,basename,ext in _possible_do_files_in_do_dir(f.name):
Expand Down
6 changes: 3 additions & 3 deletions state.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ def fix_chdir(targets):
Returns:
targets, but relative to the (newly changed) os.getcwd().
"""
abs_pwd = os.path.join(vars.STARTDIR, vars.PWD)
abs_pwd = os.path.join(vars.STARTDIR, vars.PWD).rstrip('/do')
if os.path.samefile('.', abs_pwd):
return targets # nothing to change
rel_orig_dir = os.path.relpath('.', abs_pwd)
rel_orig_dir = os.path.relpath('.', abs_pwd).rstrip('/do')
os.chdir(abs_pwd)
return [os.path.join(rel_orig_dir, t) for t in targets]

Expand Down Expand Up @@ -209,7 +209,7 @@ def printable_name(self):
will be relative to the user's starting directory, regardless of
which .do file we're in or the getcwd() of the moment.
"""
base = os.path.join(vars.PWD, self.name)
base = os.path.join(vars.PWD.rstrip('/do'), self.name)
base_full_dir = os.path.dirname(os.path.join(vars.STARTDIR, base))
norm = os.path.normpath(base)
norm_full_dir = os.path.dirname(os.path.join(vars.STARTDIR, norm))
Expand Down
7 changes: 4 additions & 3 deletions t/107-dodir/all.do
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
. ../skip-if-minimal-do.sh
rm -rf x do/log
rm -rf x y do/log
mkdir -p x/y
redo x/y/z
redo y

[ -e x/y/z ] || exit 11
[ $(wc -l <do/log) -eq 1 ] || exit 12
[ -e x/y/z -a -e y ] || exit 11
[ $(wc -l <do/log) -eq 2 ] || exit 12