fix setup.py and fastentrypoints.py
This commit is contained in:
parent
62e0767c50
commit
f94e95cbb2
|
|
@ -23,6 +23,7 @@
|
|||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
Monkey patch setuptools to write faster console_scripts with this format:
|
||||
|
||||
|
|
@ -35,8 +36,11 @@ This is better.
|
|||
(c) 2016, Aaron Christianson
|
||||
http://github.com/ninjaaron/fast-entry_points
|
||||
'''
|
||||
|
||||
from setuptools.command import easy_install
|
||||
import re
|
||||
|
||||
|
||||
TEMPLATE = r'''\
|
||||
# -*- coding: utf-8 -*-
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: '{3}','{4}','{5}'
|
||||
|
|
@ -60,15 +64,20 @@ def get_args(cls, dist, header=None):
|
|||
if header is None:
|
||||
header = cls.get_header()
|
||||
spec = str(dist.as_requirement())
|
||||
for type_ in 'console', 'gui':
|
||||
for type_ in ['console', 'gui']:
|
||||
group = type_ + '_scripts'
|
||||
for name, ep in dist.get_entry_map(group).items():
|
||||
# ensure_safe_name
|
||||
if re.search(r'[\\/]', name):
|
||||
raise ValueError("Path separators not allowed in script names")
|
||||
script_text = TEMPLATE.format(
|
||||
ep.module_name, ep.attrs[0], '.'.join(ep.attrs),
|
||||
spec, group, name)
|
||||
ep.module_name,
|
||||
ep.attrs[0],
|
||||
'.'.join(ep.attrs),
|
||||
spec,
|
||||
group,
|
||||
name
|
||||
)
|
||||
args = cls._get_script_args(type_, name, header, script_text)
|
||||
for res in args:
|
||||
yield res
|
||||
|
|
|
|||
85
setup.py
85
setup.py
|
|
@ -33,38 +33,67 @@ elif (3, 0) < version < (3, 5):
|
|||
|
||||
VERSION = '3.32'
|
||||
|
||||
install_requires = ['psutil', 'colorama', 'six']
|
||||
extras_require = {':python_version<"3.4"': ['pathlib2'],
|
||||
':python_version<"3.3"': ['backports.shutil_get_terminal_size'],
|
||||
':python_version<="2.7"': ['decorator<5', 'pyte<0.8.1'],
|
||||
':python_version>"2.7"': ['decorator', 'pyte'],
|
||||
":sys_platform=='win32'": ['win_unicode_console']}
|
||||
install_requires = [
|
||||
'psutil',
|
||||
'colorama',
|
||||
'six'
|
||||
]
|
||||
|
||||
extras_require = {
|
||||
':python_version<"3.4"': ['pathlib2'],
|
||||
':python_version<"3.3"': ['backports.shutil_get_terminal_size'],
|
||||
':python_version<="2.7"': [
|
||||
'decorator<5',
|
||||
'pyte<0.8.1'
|
||||
],
|
||||
':python_version>"2.7"': [
|
||||
'decorator',
|
||||
'pyte'
|
||||
],
|
||||
":sys_platform=='win32'": [
|
||||
'win_unicode_console'
|
||||
]
|
||||
}
|
||||
|
||||
if sys.platform == "win32":
|
||||
scripts = ['scripts\\fuck.bat', 'scripts\\fuck.ps1']
|
||||
scripts = [
|
||||
'scripts\\fuck.bat',
|
||||
'scripts\\fuck.ps1'
|
||||
]
|
||||
entry_points = {'console_scripts': [
|
||||
'thefuck = thefuck.entrypoints.main:main',
|
||||
'thefuck_firstuse = thefuck.entrypoints.not_configured:main']}
|
||||
'thefuck = thefuck.entrypoints.main:main',
|
||||
'thefuck_firstuse = thefuck.entrypoints.not_configured:main'
|
||||
]}
|
||||
else:
|
||||
scripts = []
|
||||
entry_points = {'console_scripts': [
|
||||
'thefuck = thefuck.entrypoints.main:main',
|
||||
'fuck = thefuck.entrypoints.not_configured:main']}
|
||||
'thefuck = thefuck.entrypoints.main:main',
|
||||
'fuck = thefuck.entrypoints.not_configured:main'
|
||||
]}
|
||||
|
||||
setup(name='thefuck',
|
||||
version=VERSION,
|
||||
description="Magnificent app which corrects your previous console command",
|
||||
long_description=long_description,
|
||||
author='Vladimir Iakovlev',
|
||||
author_email='nvbn.rm@gmail.com',
|
||||
url='https://github.com/nvbn/thefuck',
|
||||
license='MIT',
|
||||
packages=find_packages(exclude=['ez_setup', 'examples',
|
||||
'tests', 'tests.*', 'release']),
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
|
||||
install_requires=install_requires,
|
||||
extras_require=extras_require,
|
||||
scripts=scripts,
|
||||
entry_points=entry_points)
|
||||
package_exclude = [
|
||||
'ez_setup',
|
||||
'examples',
|
||||
'tests',
|
||||
'tests.*',
|
||||
'release'
|
||||
]
|
||||
|
||||
setup(
|
||||
name = 'thefuck',
|
||||
version = VERSION,
|
||||
description = "Magnificent app which corrects your previous console command",
|
||||
long_description = long_description,
|
||||
author = 'Vladimir Iakovlev',
|
||||
author_email = 'nvbn.rm@gmail.com',
|
||||
url = 'https://github.com/nvbn/thefuck',
|
||||
license = 'MIT',
|
||||
packages = find_packages(exclude = package_exclude),
|
||||
include_package_data = True,
|
||||
zip_safe = False,
|
||||
python_requires = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
|
||||
install_requires = install_requires,
|
||||
extras_require = extras_require,
|
||||
scripts = scripts,
|
||||
entry_points = entry_points
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue