Skip to content
Merged
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
55 changes: 27 additions & 28 deletions makestudy
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
#!/bin/bash
if [ $# == 0 ]
then
echo "Make a concore study "
#!/usr/bin/env bash

if [ "$#" -eq 0 ]; then
echo "Make a concore study"
echo " ./makestudy path/name.graphml"
echo " ./makestudy path/name.graphml study"
echo "In the first case, the name of the study is the same as the name of the .graphml"
echo "In either case, source files come from the same path as the .graphml"
echo "The equivalent mkconcore.py is displayed"
exit
fi
graphml=$1
if [ -e $graphml ]
then
sourcedir=$(dirname "$graphml")

graphml="$1"

if [ -e "$graphml" ]; then
sourcedir="$(dirname "$graphml")"
else
graphml=$graphml'.graphml'
if [ -e $graphml ]
then
sourcedir=$(dirname "$graphml")
graphml="${graphml}.graphml"
if [ -e "$graphml" ]; then
sourcedir="$(dirname "$graphml")"
else
echo "$graphml does not exist"
exit
fi
fi
if [ $# = 1 ]
then
studydir=`basename ${graphml%\.*}`

if [ "$#" -eq 1 ]; then
studydir="$(basename "${graphml%.*}")"
else
studydir=$2
studydir="$2"
fi
if [ -e $studydir ]
then
echo "cannot make $studydir because one already exists with that name"
echo "either do ./destroy $studydir, or choose a unique name as 2nd arg"

if [ -e "$studydir" ]; then
echo "Cannot make $studydir because one already exists with that name"
echo "Either do ./destroy $studydir, or choose a unique name as 2nd arg"
exit
else
which osascript >/dev/null
if [ $? == 0 ]
then
echo "python3 mkconcore.py $graphml $sourcedir $studydir macos"
python3 mkconcore.py $graphml $sourcedir $studydir macos
if command -v osascript >/dev/null; then
echo "python3 mkconcore.py \"$graphml\" \"$sourcedir\" \"$studydir\" macos"
python3 mkconcore.py "$graphml" "$sourcedir" "$studydir" macos
else
echo "python3 mkconcore.py $graphml $sourcedir $studydir ubuntu"
python3 mkconcore.py $graphml $sourcedir $studydir ubuntu
echo "python3 mkconcore.py \"$graphml\" \"$sourcedir\" \"$studydir\" ubuntu"
python3 mkconcore.py "$graphml" "$sourcedir" "$studydir" ubuntu
fi
fi
fi
48 changes: 32 additions & 16 deletions makestudy.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
@echo off
if dummy%~n2 == dummy (
if dummy%~x1 == dummy.graphml (
echo python mkconcore.py %~d1%~p1%~n1%~x1 %~d1%~p1 %~n1 windows
python mkconcore.py %~d1%~p1%~n1%~x1 %~d1%~p1 %~n1 windows
) else (
echo python mkconcore.py %~d1%~p1%~n1.graphml %~d1%~p1 %~n1 windows
python mkconcore.py %~d1%~p1%~n1.graphml %~d1%~p1 %~n1 windows
)
setlocal EnableDelayedExpansion

:: Extracting parameters safely
set "file1=%~f1"
set "file2=%~2"
set "dir1=%~dp1"
set "name1=%~n1"
set "ext1=%~x1"

:: Handling spaces in paths by ensuring the format remains intact
set "file1=!file1:\=\\!"
set "dir1=!dir1:\=\\!"

:: If the second argument (file2) is not provided
if not defined file2 (
if /I "%ext1%"==".graphml" (
echo python mkconcore.py "!file1!" "!dir1!" "!name1!" windows
python mkconcore.py "!file1!" "!dir1!" "!name1!" windows
) else (
echo python mkconcore.py "!dir1!!name1!.graphml" "!dir1!" "!name1!" windows
python mkconcore.py "!dir1!!name1!.graphml" "!dir1!" "!name1!" windows
)
) else (
if dummy%~x1 == dummy.graphml (
echo python mkconcore.py %~d1%~p1%~n1%~x1 %~d1%~p1 %~n2 windows
python mkconcore.py %~d1%~p1%~n1%~x1 %~d1%~p1 %~n2 windows
) else (
echo python mkconcore.py %~d1%~p1%~n1.graphml %~d1%~p1 %~n2 windows
python mkconcore.py %~d1%~p1%~n1.graphml %~d1%~p1 %~n2 windows
)
)
if /I "%ext1%"==".graphml" (
echo python mkconcore.py "!file1!" "!dir1!" "!file2!" windows
python mkconcore.py "!file1!" "!dir1!" "!file2!" windows
) else (
echo python mkconcore.py "!dir1!!name1!.graphml" "!dir1!" "!file2!" windows
python mkconcore.py "!dir1!!name1!.graphml" "!dir1!" "!file2!" windows
)
)

endlocal
2 changes: 0 additions & 2 deletions mkconcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
CPPEXE = "g++" #Ubuntu/macOS C++ 6/22/21
VWIN = "iverilog" #Windows verilog 6/25/21
VEXE = "iverilog" #Ubuntu/macOS verilog 6/25/21
CPPEXE = "g++" #Ubuntu/macOS C++ 6/22/21
PYTHONEXE = "python3" #Ubuntu/macOS python 3
PYTHONWIN = "python" #Windows python 3
MATLABEXE = "matlab" #Ubuntu/macOS matlab
Expand Down Expand Up @@ -74,7 +73,6 @@
print("if intended, remove or rename "+outdir+" first")
quit()

currentdir = os.getcwd()
os.mkdir(outdir)
os.chdir(outdir)
if concoretype == "windows":
Expand Down