Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
c989a1cf
Commit
c989a1cf
authored
Jun 19, 2025
by
limm
Browse files
fix the whl naming format
parent
d79540ef
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
setup.py
setup.py
+8
-11
No files found.
setup.py
View file @
c989a1cf
...
@@ -12,24 +12,21 @@ from tools import setup_helpers
...
@@ -12,24 +12,21 @@ from tools import setup_helpers
ROOT_DIR
=
Path
(
__file__
).
parent
.
resolve
()
ROOT_DIR
=
Path
(
__file__
).
parent
.
resolve
()
def
_run_cmd
(
cmd
,
shell
=
False
):
def
_run_cmd
(
cmd
):
try
:
try
:
return
subprocess
.
check_output
(
cmd
,
cwd
=
ROOT_DIR
,
stderr
=
subprocess
.
DEVNULL
).
decode
(
"ascii"
).
strip
()
return
subprocess
.
check_output
(
cmd
,
cwd
=
ROOT_DIR
,
stderr
=
subprocess
.
DEVNULL
).
decode
(
"ascii"
).
strip
()
except
Exception
:
except
Exception
:
return
None
return
None
def
_get_version
(
sha
):
def
_get_version
(
sha
):
with
open
(
ROOT_DIR
/
"version.txt"
,
"r"
)
as
f
:
with
open
(
ROOT_DIR
/
"version.txt"
,
"r"
)
as
f
:
version
=
f
.
read
().
strip
()
version
=
f
.
read
().
strip
()
if
os
.
getenv
(
"BUILD_VERSION"
):
if
os
.
getenv
(
"BUILD_VERSION"
):
version
=
os
.
getenv
(
"BUILD_VERSION"
)
version
=
os
.
getenv
(
"BUILD_VERSION"
)
elif
sha
is
not
None
:
#
elif sha is not None:
version
+=
"+"
+
sha
[:
7
]
#
version += "+" + sha[:7]
return
version
return
version
def
_make_version_file
(
version
,
sha
):
def
_make_version_file
(
version
,
sha
):
sha
=
"Unknown"
if
sha
is
None
else
sha
sha
=
"Unknown"
if
sha
is
None
else
sha
version_path
=
ROOT_DIR
/
"src"
/
"torchaudio"
/
"version.py"
version_path
=
ROOT_DIR
/
"src"
/
"torchaudio"
/
"version.py"
...
@@ -37,13 +34,11 @@ def _make_version_file(version, sha):
...
@@ -37,13 +34,11 @@ def _make_version_file(version, sha):
f
.
write
(
f
"__version__ = '
{
version
}
'
\n
"
)
f
.
write
(
f
"__version__ = '
{
version
}
'
\n
"
)
f
.
write
(
f
"git_version = '
{
sha
}
'
\n
"
)
f
.
write
(
f
"git_version = '
{
sha
}
'
\n
"
)
def
_get_pytorch_version
():
def
_get_pytorch_version
():
if
"PYTORCH_VERSION"
in
os
.
environ
:
if
"PYTORCH_VERSION"
in
os
.
environ
:
return
f
"torch==
{
os
.
environ
[
'PYTORCH_VERSION'
]
}
"
return
f
"torch==
{
os
.
environ
[
'PYTORCH_VERSION'
]
}
"
return
"torch"
return
"torch"
class
clean
(
distutils
.
command
.
clean
.
clean
):
class
clean
(
distutils
.
command
.
clean
.
clean
):
def
run
(
self
):
def
run
(
self
):
# Run default behavior first
# Run default behavior first
...
@@ -62,7 +57,6 @@ class clean(distutils.command.clean.clean):
...
@@ -62,7 +57,6 @@ class clean(distutils.command.clean.clean):
print
(
f
"removing '
{
path
}
' (and everything under it)"
)
print
(
f
"removing '
{
path
}
' (and everything under it)"
)
shutil
.
rmtree
(
str
(
path
),
ignore_errors
=
True
)
shutil
.
rmtree
(
str
(
path
),
ignore_errors
=
True
)
def
_parse_url
(
path
):
def
_parse_url
(
path
):
with
open
(
path
,
"r"
)
as
file_
:
with
open
(
path
,
"r"
)
as
file_
:
for
line
in
file_
:
for
line
in
file_
:
...
@@ -71,15 +65,14 @@ def _parse_url(path):
...
@@ -71,15 +65,14 @@ def _parse_url(path):
url
=
match
.
group
(
1
)
url
=
match
.
group
(
1
)
yield
url
yield
url
def
_fetch_archives
(
src
):
def
_fetch_archives
(
src
):
for
dest
,
url
in
src
:
for
dest
,
url
in
src
:
if
not
dest
.
exists
():
if
not
dest
.
exists
():
print
(
f
" --- Fetching
{
os
.
path
.
basename
(
dest
)
}
"
)
print
(
f
" --- Fetching
{
os
.
path
.
basename
(
dest
)
}
"
)
torch
.
hub
.
download_url_to_file
(
url
,
dest
,
progress
=
False
)
torch
.
hub
.
download_url_to_file
(
url
,
dest
,
progress
=
False
)
def
_main
():
def
_main
():
ROCM_HOME
=
os
.
getenv
(
"ROCM_PATH"
)
sha
=
_run_cmd
([
"git"
,
"rev-parse"
,
"HEAD"
])
sha
=
_run_cmd
([
"git"
,
"rev-parse"
,
"HEAD"
])
branch
=
_run_cmd
([
"git"
,
"rev-parse"
,
"--abbrev-ref"
,
"HEAD"
])
branch
=
_run_cmd
([
"git"
,
"rev-parse"
,
"--abbrev-ref"
,
"HEAD"
])
tag
=
_run_cmd
([
"git"
,
"describe"
,
"--tags"
,
"--exact-match"
,
"@"
])
tag
=
_run_cmd
([
"git"
,
"describe"
,
"--tags"
,
"--exact-match"
,
"@"
])
...
@@ -89,7 +82,11 @@ def _main():
...
@@ -89,7 +82,11 @@ def _main():
pytorch_package_dep
=
_get_pytorch_version
()
pytorch_package_dep
=
_get_pytorch_version
()
print
(
"-- PyTorch dependency:"
,
pytorch_package_dep
)
print
(
"-- PyTorch dependency:"
,
pytorch_package_dep
)
version
=
_get_version
(
sha
)
version
=
_get_version
(
sha
)
version
+=
"+das.opt1"
print
(
"-- Building version"
,
version
)
print
(
"-- Building version"
,
version
)
dtk
=
_run_cmd
([
"cat"
,
os
.
path
.
join
(
ROCM_HOME
,
'.info/rocm_version'
)])
print
(
f
"-- dtk_version =
{
dtk
}
"
)
version
+=
".dtk"
+
dtk
_make_version_file
(
version
,
sha
)
_make_version_file
(
version
,
sha
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment