-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
action: Add pypi release pipeline (#277)
* try * try * fix * add dependency * add list * fix * fix * fix permission * typo * fix * add way to specify manually * use dispatch * try fix * fix * remove * remove
- Loading branch information
Showing
3 changed files
with
69 additions
and
10 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
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 |
---|---|---|
|
@@ -17,12 +17,18 @@ | |
from setuptools import setup, Extension, find_packages | ||
from setuptools.command.build_ext import build_ext | ||
import subprocess | ||
|
||
import logging | ||
|
||
with open("README.md", "r", encoding="utf-8") as f: | ||
readme = f.read() | ||
|
||
|
||
def build_envd_if_not_found(): | ||
if not os.path.exists("bin/envd"): | ||
logging.info("envd not found. Build from scratch") | ||
errno = subprocess.call(["make", "build"]) | ||
assert errno == 0, "Failed to build envd" | ||
|
||
class EnvdExtension(Extension): | ||
"""Extension for `envd`""" | ||
|
||
|
@@ -33,32 +39,35 @@ def build_extension(self, ext: Extension) -> None: | |
return super().build_extension(ext) | ||
|
||
bin_path = os.path.join(self.build_lib, "envd", "bin") | ||
errno = subprocess.call(["make", "build"]) | ||
assert errno == 0, "Failed to build envd" | ||
build_envd_if_not_found() | ||
os.makedirs(bin_path, exist_ok=True) | ||
shutil.copy("bin/envd", bin_path) | ||
|
||
|
||
def get_version(): | ||
subprocess.call(["make", "build"]) | ||
# Remove prefix v in versioning | ||
build_envd_if_not_found() | ||
version = subprocess.check_output( | ||
["./bin/envd", "-v"], universal_newlines=True | ||
["./bin/envd", "version", "--short"], universal_newlines=True | ||
).strip() | ||
return version.rsplit(" ", 1)[-1] | ||
ver = version.rsplit(" ", 1)[-1][1:] | ||
return ver | ||
|
||
|
||
setup( | ||
name="envd", | ||
version=get_version(), | ||
use_scm_version = True, | ||
setup_requires=['setuptools_scm'], | ||
description="A development environment management tool for data scientists.", | ||
long_description=readme, | ||
long_description=readme, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/tensorchord/envd", | ||
license="Apache License 2.0", | ||
author="TensorChord", | ||
author_email="[email protected]", | ||
packages=find_packages(), | ||
include_package_data=True, | ||
python_requires=">=3.6", | ||
entry_points={ | ||
"console_scripts": [ | ||
"envd=envd.cmd:envd", | ||
|