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
1a7aec98
"torchvision/vscode:/vscode.git/clone" did not exist on "da7680f027762577d84577b59f41221cff07d341"
Unverified
Commit
1a7aec98
authored
Oct 18, 2021
by
moto
Committed by
GitHub
Oct 18, 2021
Browse files
Exclude prototype in release build (#1881)
parent
420e84ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
9 deletions
+35
-9
setup.py
setup.py
+35
-9
No files found.
setup.py
View file @
1a7aec98
#!/usr/bin/env python
import
os
import
re
import
shutil
import
subprocess
from
pathlib
import
Path
...
...
@@ -11,25 +12,27 @@ from tools import setup_helpers
ROOT_DIR
=
Path
(
__file__
).
parent
.
resolve
()
def
_run_cmd
(
cmd
):
try
:
return
subprocess
.
check_output
(
cmd
,
cwd
=
ROOT_DIR
).
decode
(
'ascii'
).
strip
()
except
Exception
:
return
None
# Creating the version file
version
=
'0.11.0a0'
sha
=
'Unknown'
try
:
sha
=
subprocess
.
check_output
([
'git'
,
'rev-parse'
,
'HEAD'
],
cwd
=
ROOT_DIR
).
decode
(
'ascii'
).
strip
()
except
Exception
:
pass
sha
=
_run_cmd
([
'git'
,
'rev-parse'
,
'HEAD'
])
if
os
.
getenv
(
'BUILD_VERSION'
):
version
=
os
.
getenv
(
'BUILD_VERSION'
)
elif
sha
!=
'Unknown'
:
elif
sha
is
not
None
:
version
+=
'+'
+
sha
[:
7
]
print
(
'-- Building version '
+
version
)
version_path
=
ROOT_DIR
/
'torchaudio'
/
'version.py'
with
open
(
version_path
,
'w'
)
as
f
:
f
.
write
(
"__version__ = '{}'
\n
"
.
format
(
version
))
f
.
write
(
"git_version = {}
\n
"
.
format
(
repr
(
sha
)))
f
.
write
(
"git_version = {}
\n
"
.
format
(
repr
(
sha
or
'Unknown'
)))
pytorch_package_version
=
os
.
getenv
(
'PYTORCH_VERSION'
)
...
...
@@ -57,6 +60,29 @@ class clean(distutils.command.clean.clean):
shutil
.
rmtree
(
str
(
path
),
ignore_errors
=
True
)
def
_get_packages
():
exclude
=
[
"build*"
,
"test*"
,
"torchaudio.csrc*"
,
"third_party*"
,
"tools*"
,
]
exclude_prototype
=
False
branch_name
=
_run_cmd
([
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'HEAD'
])
is_on_tag
=
_run_cmd
([
'git'
,
'describe'
,
'--tags'
,
'--exact-match'
,
'@'
])
print
(
'-- On branch:'
,
branch_name
)
print
(
'-- On tag:'
,
is_on_tag
)
if
branch_name
is
not
None
and
branch_name
.
startswith
(
'release/'
):
exclude_prototype
=
True
if
is_on_tag
is
not
None
and
re
.
match
(
r
'v[\d.]+(-rc\d+)?'
,
is_on_tag
):
exclude_prototype
=
True
if
exclude_prototype
:
print
(
'Excluding torchaudio.prototype from the package.'
)
exclude
.
append
(
"torchaudio.prototype"
)
return
find_packages
(
exclude
=
exclude
)
setup
(
name
=
"torchaudio"
,
version
=
version
,
...
...
@@ -81,7 +107,7 @@ setup(
"Topic :: Multimedia :: Sound/Audio"
,
"Topic :: Scientific/Engineering :: Artificial Intelligence"
],
packages
=
find
_packages
(
exclude
=
[
"build*"
,
"test*"
,
"torchaudio.csrc*"
,
"third_party*"
,
"tools*"
]
),
packages
=
_get
_packages
(),
ext_modules
=
setup_helpers
.
get_ext_modules
(),
cmdclass
=
{
'build_ext'
:
setup_helpers
.
CMakeBuild
,
...
...
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