-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsync_readme.py
30 lines (22 loc) · 982 Bytes
/
sync_readme.py
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
def sync_readme():
"""
Synchronize README files between the top-level directory and the package directory.
Copies the README.md file from the top-level directory to the package directory to ensure that the
package contains the most recent documentation when uploaded or built.
"""
import shutil
import os
# Get the current script directory
script_dir = os.path.dirname(os.path.abspath(__file__))
# Define source and destination paths
source = os.path.join(script_dir, 'README.md')
destination = os.path.join(script_dir, 'src', 'masa_ai', 'docs', 'source', 'README.md')
# Check if the source file exists
if not os.path.exists(source):
raise FileNotFoundError(f"Source file not found: {source}")
# Copy the README.md file
shutil.copy2(source, destination)
# Notify that the files have been synchronized
print(f"Synchronized {source} to {destination}")
if __name__ == '__main__':
sync_readme()