forked from pydantic/pydantic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_v1.sh
More file actions
executable file
·31 lines (21 loc) · 752 Bytes
/
update_v1.sh
File metadata and controls
executable file
·31 lines (21 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /usr/bin/env bash
set -x
set -e
echo "cloning pydantic V1"
git clone -b 1.10.X-fixes https://github.com/pydantic/pydantic.git pydantic-v1
pushd "$(dirname $0)/pydantic-v1"
# Find latest tag in v1
latest_tag=$(git describe --tags --abbrev=0)
echo "latest tag in V1 is '${latest_tag}'"
git checkout "${latest_tag}"
# Remove current V1
rm -rf ../pydantic/v1
# Copy new V1 into pydantic/v1
cp -r pydantic ../pydantic/v1
# Remove the v1 sub directory from v1, it's not needed in the v2 codebase
rm -rf ../pydantic/v1/v1
# Update imports in pydantic/v1 to use pydantic.v1
find "../pydantic/v1" -name "*.py" -exec sed -i '' -E 's/from pydantic(\.[a-zA-Z0-9_]*)? import/from pydantic.v1\1 import/g' {} \;
popd
# Remove V1 clone
rm -rf pydantic-v1