forked from andreikop/cpp2python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
109 lines (83 loc) · 3.27 KB
/
Copy pathsetup.py
File metadata and controls
109 lines (83 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import os
import subprocess
import sys
import pkg_resources
import subprocess
import sys
from glob import glob
from os.path import abspath, basename, dirname, join, normpath, relpath
from shutil import rmtree
from textwrap import dedent
from setuptools import setup
from setuptools import Command
here = normpath(abspath(dirname(__file__)))
class CleanCommand(Command):
"""Custom clean command to tidy up the project root."""
CLEAN_FILES = './build ./dist ./*.pyc ./*.tgz ./*.egg-info ./__pycache__'.split(' ')
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
global here
for path_spec in self.CLEAN_FILES:
# Make paths absolute and relative to this path
abs_paths = glob(normpath(join(here, path_spec)))
for path in [str(p) for p in abs_paths]:
if not path.startswith(here):
# Die if path in CLEAN_FILES is absolute + outside this directory
raise ValueError("%s is not a path inside %s" % (path, here))
print('removing %s' % relpath(path))
try:
rmtree(path)
except:
pass
long_description=dedent("""
cpp2python
Script helps to convert C/C++ sources to C/C++ -like Python sources.
It does few simple edit operations, like removing semicolons and type declarations. After it you must edit code manually, but you'll spend less time to do it.
Utility will make mistaces and will not generate ready for use code, so, it won't help you, unless if you know either C/C++ and Python
For better result, it is recomented to format your code to ANSI style before doing conversion.
NO ANY BACKUPS ARE CREATED. YOU MAY PERMANENTLY CORRUPT YOR SOURCES
Usage:
cpp2python.py DIR|FILE
cpp2python.py -v|--version|-h|--help
When directory name is given - tries to find source files by C/C++ suffixes, when file name is given - processes given file
Author: Andrei Kopats hlamer@tut.by License: GPL
""")
setup(
cmdclass={
'clean': CleanCommand,
},
name='cpp2python',
version='0.1.0',
description='Helps to convert C/C++ sources to C/C++ -like Python sources.',
long_description=long_description,
url='https://github.com/hlamer/cpp2python',
author='Andrei Kopats',
author_email='hlamer@tut.by',
license='GPL',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
],
keywords='cpp python',
packages = ["cpp2python"],
entry_points = {
'console_scripts': [
'cpp2python = cpp2python:main'
]
},
)