Skip to content

Commit c05c9ff

Browse files
committed
Implement as Python package
1 parent 7a42ae3 commit c05c9ff

37 files changed

+257
-193
lines changed

.coveragerc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ exclude_lines =
55

66
[run]
77
omit =
8-
shivyc.py
8+
shivyc/main.py
9+
setup.py

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ test.c
1111
\#*#
1212
tests/**/*.s
1313
tests/**/*.o
14+
shivyc.egg-info/*
File renamed without changes.

setup.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
"""ShivyC installation script."""
2+
3+
import sys
4+
5+
from setuptools import setup, find_packages
6+
from codecs import open
7+
from os import path
8+
9+
if sys.version_info[0] < 3:
10+
sys.exit("ShivyC only supports Python 3.")
11+
12+
here = path.abspath(path.dirname(__file__))
13+
14+
# Get the long description from the README file
15+
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
16+
long_description = f.read()
17+
18+
setup(
19+
name='shivyc',
20+
version='0.1.0',
21+
22+
description='A C compiler written in Python',
23+
long_description=long_description,
24+
25+
# The project's main homepage.
26+
url='https://github.com/ShivamSarodia/ShivyC',
27+
28+
# Author details
29+
author='Shivam Sarodia',
30+
author_email='[email protected]',
31+
32+
# Choose your license
33+
license='MIT',
34+
35+
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
36+
classifiers=[
37+
'Development Status :: 3 - Alpha',
38+
'Environment :: Console',
39+
'License :: OSI Approved :: MIT License',
40+
'Programming Language :: Python :: 3',
41+
'Programming Language :: Python :: 3.5',
42+
'Programming Language :: Python :: 3.6',
43+
'Programming Language :: C',
44+
'Topic :: Software Development',
45+
'Topic :: Software Development :: Compilers',
46+
'Topic :: Software Development :: Code Generators',
47+
'Topic :: Software Development :: Build Tools',
48+
'Intended Audience :: Developers',
49+
'Intended Audience :: Education',
50+
],
51+
52+
keywords='shivyc compiler c programming parsing',
53+
packages=find_packages(exclude=['tests']),
54+
install_requires=[],
55+
package_data={
56+
'sample': ['include/*.h'],
57+
},
58+
59+
entry_points={
60+
'console_scripts': [
61+
'shivyc=shivyc.main:main',
62+
],
63+
},
64+
)
File renamed without changes.

asm_gen.py renamed to shivyc/asm_gen.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import itertools
44

5-
import asm_cmds
6-
import spots
7-
from spots import Spot
5+
import shivyc.asm_cmds as asm_cmds
6+
import shivyc.spots as spots
7+
from shivyc.spots import Spot
88

99

1010
class ASMCode:

ctypes.py renamed to shivyc/ctypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""All of the C types recognized by the compiler."""
22

3-
import token_kinds
3+
import shivyc.token_kinds as token_kinds
44

55

66
class CType:
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)