Skip to content
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
14 changes: 12 additions & 2 deletions asv/commands/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def run(cls, dest=".", top_level=None):

template_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'template')
for entry in os.listdir(template_path):
if entry not in ("asv.conf.json", "benchmarks"):
continue
path = os.path.join(template_path, entry)
dest_path = os.path.join(dest, entry)
if os.path.exists(dest_path):
Expand All @@ -83,10 +85,18 @@ def run(cls, dest=".", top_level=None):
for entry in os.listdir(template_path):
path = os.path.join(template_path, entry)
dest_path = os.path.join(dest, entry)
if entry == ".gitignore" and os.path.exists(dest_path):
with open(path, "r") as f:
template_content = f.read()
with open(dest_path, "a") as f:
f.write("\n")
f.write(template_content)
continue

if os.path.isdir(path):
shutil.copytree(path, os.path.join(dest, entry))
shutil.copytree(path, dest_path)
elif os.path.isfile(path):
shutil.copyfile(path, os.path.join(dest, entry))
shutil.copyfile(path, dest_path)

if top_level:
conf_file = os.path.join(dest, 'asv.conf.json')
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1582.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug where ``asv quickstart`` would silently fail if a ``.gitignore`` file already existed in the target directory.