forked from jeffkowalski/geeknote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·101 lines (85 loc) · 2.88 KB
/
setup.py
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
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
import os
import shutil
import codecs
from setuptools import setup
from setuptools.command.install import install
import traceback
def read(fname):
return codecs.open(os.path.join(os.path.dirname(__file__), fname)).read()
class full_install(install):
user_options = install.user_options + [
('bash-completion-dir=', None,
"(Linux only) Set bash completion directory (default: /etc/bash_completion.d)"
),
('zsh-completion-dir=', None,
"(Linux only) Set zsh completion directory (default: /usr/local/share/zsh/site-functions)"
)
]
def initialize_options(self):
install.initialize_options(self)
self.bash_completion_dir = '/etc/bash_completion.d'
self.zsh_completion_dir = '/usr/local/share/zsh/site-functions'
def run(self):
if sys.platform.startswith('linux'):
self.install_autocomplete()
install.run(self)
def install_autocomplete(self):
def copy_autocomplete(src,dst):
try:
if os.path.exists(dst):
shutil.copy(src,dst)
print('copying %s -> %s' % (src,dst))
except IOError:
print('cannot copy autocomplete script %s to %s, got root ?' % (src,dst))
print(traceback.format_exc())
print("installing autocomplete")
copy_autocomplete('completion/bash_completion/_geeknote',self.bash_completion_dir)
copy_autocomplete('completion/zsh_completion/_geeknote',self.zsh_completion_dir)
with open('geeknote/__init__.py') as f: exec(f.read()) # read __version__
setup(
name='geeknote',
version=__version__,
license='GPL',
author='Jeff Kowalski',
#author_email='',
description='Geeknote - is a command line client for Evernote, '
'that can be used on Linux, FreeBSD and OS X.',
long_description=read("README.md"),
url='http://github.com/jeffkowalski/geeknote',
packages=['geeknote'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Environment :: Console',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Utilities',
],
install_requires=[
'evernote>=1.25',
'html2text',
'sqlalchemy',
'markdown2',
'beautifulsoup4',
'thrift',
'proxyenv',
'lxml'
],
entry_points={
'console_scripts': [
'geeknote = geeknote.geeknote:main',
'gnsync = geeknote.gnsync:main'
]
},
cmdclass={
'install': full_install,
},
platforms='Any',
zip_safe=True,
keywords='Evernote, console'
)