-
-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f716ac6
commit fe9a9dc
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ __pycache__/ | |
*.so | ||
|
||
# Distribution / packaging | ||
.python_dependencies.zip | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import shutil | ||
import zipfile | ||
from pathlib import Path | ||
|
||
|
||
def main(): | ||
root = Path(__file__).parent.parent | ||
deps = root / '.python_dependencies' | ||
deps_to_zip = [deps / 'transformers'] | ||
|
||
for dep in deps_to_zip: | ||
if not dep.exists(): | ||
raise FileNotFoundError(dep) | ||
elif not dep.is_dir(): | ||
raise EnvironmentError(f"not a directory {dep}") | ||
|
||
zip_deps_path = root / '.python_dependencies.zip' | ||
zip_deps_path.unlink(True) | ||
with zipfile.PyZipFile(str(zip_deps_path), mode='x') as zip_deps: | ||
for dep in deps_to_zip: | ||
zip_deps.writepy(str(dep)) | ||
shutil.rmtree(str(dep)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |