Skip to content

Commit 744d292

Browse files
committed
Fix install issue and update setup.py
1 parent 348a3a3 commit 744d292

File tree

4 files changed

+36
-13
lines changed

4 files changed

+36
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![codecov](https://codecov.io/gh/shenxianpeng/clang-tools-pip/branch/master/graph/badge.svg?token=40G5ZOIRRR)](https://codecov.io/gh/shenxianpeng/clang-tools-pip) [![Python application](https://github.com/shenxianpeng/clang-tools-pip/actions/workflows/python-test.yml/badge.svg)](https://github.com/shenxianpeng/clang-tools-pip/actions/workflows/python-test.yml)
44

5-
Install clang-tools <sub><sup>(clang-format & clang-tidy)</sup></sub> with pip.
5+
Install clang-tools (clang-format, clang-tidy) with pip.
66

77
## Install
88

clang_tools/install.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import shutil
44
import os
55
from posixpath import basename
6-
from clang_tools.util import check_os
6+
from clang_tools.util import check_install_os
77
from clang_tools.util import download_file
88

99
def clang_format_exist(version) -> bool:
@@ -30,36 +30,37 @@ def clang_tidy_exist(version) -> bool:
3030
exist = False
3131
return exist
3232

33-
def clang_tools_binary_url(tool, version, os) -> string:
34-
return f"https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-208096c1/{tool}-{version}_{os}-amd64"
33+
def clang_tools_binary_url(tool, version) -> string:
34+
install_os = check_install_os()
35+
return f"https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-208096c1/{tool}-{version}_{install_os}-amd64"
3536

3637
def install_clang_format(version) -> None:
3738
if clang_format_exist(version):
3839
return
39-
clang_format_binary_url = clang_tools_binary_url("clang-format", version, os)
40+
clang_format_binary_url = clang_tools_binary_url("clang-format", version)
4041
clang_format_binary = basename(clang_format_binary_url)
4142
download_file(clang_format_binary_url, clang_format_binary)
4243
install_clang_binary(clang_format_binary, f"clang-format-{version}")
4344

4445
def install_clang_tidy(version) -> None:
4546
if clang_tidy_exist(version):
4647
return
47-
clang_tidy_binary_url = clang_tools_binary_url("clang-tidy", version, os)
48+
clang_tidy_binary_url = clang_tools_binary_url("clang-tidy", version)
4849
clang_tidy_binary = basename(clang_tidy_binary_url)
4950
download_file(clang_tidy_binary_url, clang_tidy_binary)
5051
install_clang_binary(clang_tidy_binary, f"clang-tidy-{version}")
5152

5253
def install_clang_binary(old_file_name, new_file_name) -> None:
5354
"""Move download clang-tools binary and move to bin dir with right permission."""
54-
os = check_os()
55-
if os in ['linux', 'macosx']:
55+
install_os = check_install_os()
56+
if install_os in ['linux', 'macosx']:
5657
clang_tools_dir = "/usr/bin"
57-
elif os == "windows":
58+
elif install_os == "windows":
5859
clang_tools_dir = "C:/bin"
5960
else:
60-
raise Exception(f"Not support {os}")
61+
raise Exception(f"Not support {install_os}")
6162
shutil.move(old_file_name, f"{clang_tools_dir}/{new_file_name}")
62-
os.chmod(f"{clang_tools_dir}/{new_file_name}", "0777")
63+
os.chmod(os.path.join(clang_tools_dir, new_file_name), 0o777)
6364

6465
def install_clang_tools(version) -> None:
6566
install_clang_format(version)

clang_tools/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import platform
55

66

7-
def check_os() -> string:
7+
def check_install_os() -> string:
88
os = platform.system().lower()
99
return os
1010

setup.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
11
from setuptools import setup, find_packages
22

3+
with open("README.md", "r") as file:
4+
long_description = file.read()
5+
36
setup(
47
name="clang_tools",
58
version = "0.0.1",
9+
description="Install clang-tools (clang-format, clang-tidy) with pip",
10+
long_description=long_description,
11+
long_description_content_type="text/markdown",
612
author="Peter Shen",
713
author_email="xianpeng.shen@gmail.com",
8-
keywords="clang clang-tools clang-extra clang-tidy clang-format",
14+
keywords=["clang", "clang-tools", "clang-extra", "clang-tidy", "clang-format"],
15+
license="MIT License",
916
packages = find_packages(),
17+
project_urls={
18+
"Source": "https://github.com/shenxianpeng/clang-tools-pip",
19+
"Tracker": "https://github.com/shenxianpeng/clang-tools-pip/issues"
20+
},
21+
classifiers=[
22+
# https://pypi.org/pypi?%3Aaction=list_classifiers
23+
"Development Status :: 1 - Planning",
24+
"Intended Audience :: Developers",
25+
"Intended Audience :: System Administrators",
26+
"Intended Audience :: Information Technology",
27+
"Natural Language :: English",
28+
"Operating System :: OS Independent",
29+
"Programming Language :: Python :: 3.8",
30+
"Topic :: Utilities",
31+
],
1032
entry_points={
1133
"console_scripts": [
1234
"clang-tools=clang_tools.main:main"

0 commit comments

Comments
 (0)