Added setuptools and published to PyPI, so that it can be installed with pip.
This commit is contained in:
parent
a11884156f
commit
cef4425d28
0
README.rst
Normal file
0
README.rst
Normal file
26
obasync.py → bin/obasync
Executable file → Normal file
26
obasync.py → bin/obasync
Executable file → Normal file
@ -8,26 +8,28 @@ import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
# Finds uno.py for MS-Windows
|
||||
|
||||
def append_uno_path():
|
||||
""" Appends the path of the uno module to the import path. """
|
||||
|
||||
is_found_uno = False
|
||||
for p in sys.path:
|
||||
if os.path.exists(os.path.join(p, "uno.py")):
|
||||
is_found_uno = True
|
||||
break
|
||||
if not is_found_uno:
|
||||
return
|
||||
# For uno.py on MacOS
|
||||
cand = "/Applications/OpenOffice.app/Contents/MacOS"
|
||||
if os.path.exists(os.path.join(cand, "uno.py")):
|
||||
sys.path.append(cand)
|
||||
return
|
||||
# Finds uno.py for MS-Windows
|
||||
cand = sys.executable
|
||||
while cand != os.path.dirname(cand):
|
||||
cand = os.path.dirname(cand)
|
||||
if os.path.exists(os.path.join(cand, "uno.py")):
|
||||
sys.path.append(cand)
|
||||
is_found_uno = True
|
||||
break
|
||||
# For uno.py on MacOS
|
||||
if not is_found_uno:
|
||||
cand = "/Applications/OpenOffice.app/Contents/MacOS"
|
||||
if os.path.exists(os.path.join(cand, "uno.py")):
|
||||
sys.path.append(cand)
|
||||
is_found_uno = True
|
||||
return
|
||||
|
||||
append_uno_path()
|
||||
import uno
|
||||
from com.sun.star.connection import NoConnectException
|
||||
|
22
setup.py
Executable file
22
setup.py
Executable file
@ -0,0 +1,22 @@
|
||||
import os
|
||||
import sys
|
||||
from setuptools import setup
|
||||
|
||||
# For Python shipped with OpenOffice, python is a wrapper
|
||||
# for python.bin that fixes the import and library path. We should
|
||||
# call python instead of python.bin. """
|
||||
import os
|
||||
import sys
|
||||
if os.path.basename(sys.executable) == "python.bin":
|
||||
sys.executable = os.path.join(
|
||||
os.path.dirname(sys.executable), "python")
|
||||
|
||||
setup(name="obasync",
|
||||
version="0.1",
|
||||
description="Office Basic macro source synchronizer",
|
||||
url="https://github.com/imacat/obasync",
|
||||
author="imacat",
|
||||
author_email="imacat@mail.imacat.idv.tw",
|
||||
license="Apache License, Version 2.0",
|
||||
zip_safe=False,
|
||||
scripts=["bin/obasync"])
|
Loading…
Reference in New Issue
Block a user