-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create archive during build and use new ansys action option to only c…
…reate archive (#23)
- Loading branch information
1 parent
aa8f055
commit a42888d
Showing
5 changed files
with
79 additions
and
1 deletion.
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
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,12 @@ | ||
import glob | ||
import os | ||
|
||
|
||
def clean_dist(): | ||
for file in glob.glob("dist/*.whl"): | ||
os.remove(file) | ||
print(f"Removed {file}") | ||
|
||
|
||
if __name__ == "__main__": | ||
clean_dist() |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import os | ||
|
||
from setuptools import find_packages, setup | ||
from setuptools.command.bdist_wheel import bdist_wheel as _bdist_wheel | ||
from setuptools.command.sdist import sdist as _sdist | ||
|
||
description = "Ansys Tools Ominverse Extension" | ||
HERE = os.path.abspath(os.path.dirname(__file__)) | ||
with open(os.path.join(HERE, "README.rst"), encoding="utf-8") as f: | ||
long_description = f.read() | ||
|
||
|
||
class CustomSdist(_sdist): | ||
def make_distribution(self): | ||
# Ensure the 'exts' folder is included in the tar archive | ||
self.filelist.files = [ | ||
f | ||
for f in self.filelist.files | ||
if f.startswith("exts") or f in ["setup.py", "pyproject.toml", "README.rst"] | ||
] | ||
for root, dirs, files in os.walk("exts"): | ||
for file in files: | ||
self.filelist.files.append(os.path.join(root, file)) | ||
super().make_distribution() | ||
|
||
|
||
class CustomBdistWheel(_bdist_wheel): | ||
def run(self): | ||
# Create a dummy wheel file to satisfy the build process | ||
dist_dir = os.path.join( | ||
self.dist_dir, | ||
f"{self.distribution.get_name()}-{self.distribution.get_version()}-py3-none-any.whl", | ||
) | ||
with open(dist_dir, "w") as f: | ||
f.write("") | ||
print(f"Created dummy wheel file at {dist_dir}") | ||
# Call the original run method to ensure any other necessary steps are completed | ||
super().run() | ||
|
||
# Remove the dummy wheel file | ||
if os.path.exists(dist_dir): | ||
os.remove(dist_dir) | ||
print(f"Removed dummy wheel file at {dist_dir}") | ||
|
||
|
||
setup( | ||
name="ansys-tools-omniverse", | ||
packages=find_packages(), | ||
cmdclass={ | ||
"sdist": CustomSdist, | ||
"bdist_wheel": CustomBdistWheel, | ||
}, | ||
include_package_data=True, | ||
long_description=long_description, | ||
long_description_content_type="text/x-rst", # This is the key line | ||
) |