Skip to content

Commit 307c1d9

Browse files
committed
[cmpcodesize] Use setuptools for installation
By adding a setup.py file, users may install cmpcodesize to their PATH, by running `python utils/cmpcodesize/setup.py install`. Should the Swift project choose to do so, this package may also be uploaded to the Python Package Index (https://pypi.python.org/pypi). Doing so would allow anyone with an Internet connection to install cmpcodesize by running `pip install cmpcodesize`. Setuptools also provides a convenient way to run unit tests (yet to be added as of this commit).
1 parent 7932796 commit 307c1d9

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

utils/cmpcodesize/.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Compile artifacts
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Distribution/packaging
7+
.Python
8+
env/
9+
build/
10+
develop-eggs/
11+
dist/
12+
downloads/
13+
eggs/
14+
.eggs/
15+
lib/
16+
lib64/
17+
parts/
18+
sdist/
19+
var/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
24+
# Installer logs
25+
pip-log.txt
26+
pip-delete-this-directory.txt

utils/cmpcodesize/setup.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import os
2+
import setuptools
3+
4+
import cmpcodesize
5+
6+
# setuptools expects to be invoked from within the directory of setup.py,
7+
# but it is nice to allow `python path/to/setup.py install` to work
8+
# (for scripts, etc.)
9+
os.chdir(os.path.dirname(os.path.abspath(__file__)))
10+
11+
setuptools.setup(
12+
name="cmpcodesize",
13+
version=cmpcodesize.__version__,
14+
15+
author=cmpcodesize.__author__,
16+
author_email=cmpcodesize.__email__,
17+
url='http://swift.org',
18+
license='Apache',
19+
20+
description="A tool to compare the size of Swift compiler build products.",
21+
keywords='compare size swift',
22+
23+
classifiers=[
24+
'Development Status :: 3 - Alpha',
25+
'Environment :: Console',
26+
'Intended Audience :: Developers',
27+
'License :: OSI Approved :: Apache Software License',
28+
'Natural Language :: English',
29+
'Operating System :: OS Independent',
30+
'Programming Language :: Python',
31+
'Topic :: Software Development :: Compilers',
32+
],
33+
34+
zip_safe=False,
35+
packages=setuptools.find_packages(),
36+
entry_points={
37+
'console_scripts': [
38+
'cmpcodesize = cmpcodesize:main',
39+
],
40+
}
41+
)

0 commit comments

Comments
 (0)