9797
9898 if git ls-remote --heads "$REMOTE" "$REF" | grep -q "refs/heads/$REF"; then
9999 echo "Using MathCAT branch $REF"
100+ # Rewrite any active mathcat dep (version=, path=, or prior git=); features line first
100101 sed -i.bak \
101- -e "s|mathcat = { path = \"../MathCAT/\" }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\" }|" \
102- -e "s|mathcat = { path = \"../MathCAT/\", features = \[\"include-zip\"\] }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\", features = [\"include-zip\"] }|" \
102+ -e "s|^ mathcat = {.*features = \[\"include-zip\"\].* }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\", features = [\"include-zip\"] }|" \
103+ -e "/ features = \[\"include-zip\"\]/!s|^mathcat = {.* }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\" }|" \
103104 Cargo.toml
104105 else
105106 echo "No matching branch in MathCAT; falling back to latest tag"
@@ -112,8 +113,8 @@ jobs:
112113 echo "Syncing package version to MathCAT $VERSION"
113114 sed -i.bak \
114115 -e "/^\[package\]/,/^\[/{s/^version = \".*\"/version = \"$VERSION\"/;}" \
115- -e 's|mathcat = { path = "../MathCAT/" }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest" }|' \
116- -e 's|mathcat = { path = "../MathCAT/", features = \["include-zip"\] }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest", features = ["include-zip"] }|' \
116+ -e 's|^ mathcat = {.*features = \["include-zip"\].* }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest", features = ["include-zip"] }|' \
117+ -e '/ features = \["include-zip"\]/!s|^mathcat = {.* }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest" }|' \
117118 Cargo.toml
118119 rm -f Cargo.toml.bak
119120 fi
@@ -169,9 +170,10 @@ jobs:
169170
170171 if git ls-remote --heads "$REMOTE" "$REF" | grep -q "refs/heads/$REF"; then
171172 echo "Using MathCAT branch $REF"
173+ # Rewrite any active mathcat dep (version=, path=, or prior git=); features line first
172174 sed -i.bak \
173- -e "s|mathcat = { path = \"../MathCAT/\" }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\" }|" \
174- -e "s|mathcat = { path = \"../MathCAT/\", features = \[\"include-zip\"\] }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\", features = [\"include-zip\"] }|" \
175+ -e "s|^ mathcat = {.*features = \[\"include-zip\"\].* }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\", features = [\"include-zip\"] }|" \
176+ -e "/ features = \[\"include-zip\"\]/!s|^mathcat = {.* }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\" }|" \
175177 Cargo.toml
176178 else
177179 echo "No matching branch in MathCAT; falling back to latest tag"
@@ -184,8 +186,8 @@ jobs:
184186 echo "Syncing package version to MathCAT $VERSION"
185187 sed -i.bak \
186188 -e "/^\[package\]/,/^\[/{s/^version = \".*\"/version = \"$VERSION\"/;}" \
187- -e 's|mathcat = { path = "../MathCAT/" }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest" }|' \
188- -e 's|mathcat = { path = "../MathCAT/", features = \["include-zip"\] }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest", features = ["include-zip"] }|' \
189+ -e 's|^ mathcat = {.*features = \["include-zip"\].* }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest", features = ["include-zip"] }|' \
190+ -e '/ features = \["include-zip"\]/!s|^mathcat = {.* }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest" }|' \
189191 Cargo.toml
190192 rm -f Cargo.toml.bak
191193 fi
@@ -247,10 +249,11 @@ jobs:
247249 echo "Failed to read MathCAT version from branch $REF" >&2
248250 exit 1
249251 fi
252+ # Rewrite any active mathcat dep (version=, path=, or prior git=); features line first
250253 sed -i.bak \
251254 -e "/^\[package\]/,/^\[/{s/^version = \".*\"/version = \"$VERSION\"/;}" \
252- -e "s|mathcat = { path = \"../MathCAT/\" }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\" }|" \
253- -e "s|mathcat = { path = \"../MathCAT/\", features = \[\"include-zip\"\] }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\", features = [\"include-zip\"] }|" \
255+ -e "s|^ mathcat = {.*features = \[\"include-zip\"\].* }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\", features = [\"include-zip\"] }|" \
256+ -e "/ features = \[\"include-zip\"\]/!s|^mathcat = {.* }|mathcat = { git = \"https://github.com/NSoiffer/MathCAT\", branch = \"$REF\" }|" \
254257 Cargo.toml
255258 else
256259 echo "No matching branch in MathCAT; falling back to latest tag"
@@ -263,8 +266,8 @@ jobs:
263266 echo "Syncing package version to MathCAT $VERSION"
264267 sed -i.bak \
265268 -e "/^\[package\]/,/^\[/{s/^version = \".*\"/version = \"$VERSION\"/;}" \
266- -e 's|mathcat = { path = "../MathCAT/" }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest" }|' \
267- -e 's|mathcat = { path = "../MathCAT/", features = \["include-zip"\] }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest", features = ["include-zip"] }|' \
269+ -e 's|^ mathcat = {.*features = \["include-zip"\].* }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest", features = ["include-zip"] }|' \
270+ -e '/ features = \["include-zip"\]/!s|^mathcat = {.* }|mathcat = { git = "https://github.com/NSoiffer/MathCAT", tag = "latest" }|' \
268271 Cargo.toml
269272 rm -f Cargo.toml.bak
270273 fi
0 commit comments