[MRG] Add ghostscript fix for windows (#124)
* Add ghostscript fix for windows * Add python2 fix * Update install.rstpull/2/head
parent
f7e69bbbfe
commit
cf7823f33c
|
|
@ -174,14 +174,34 @@ class Lattice(BaseParser):
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def _generate_image(self):
|
def _generate_image(self):
|
||||||
|
# TODO: hacky, get rid of ghostscript #96
|
||||||
|
def get_platform():
|
||||||
|
import platform
|
||||||
|
|
||||||
|
info = {
|
||||||
|
'system': platform.system().lower(),
|
||||||
|
'machine': platform.machine().lower()
|
||||||
|
}
|
||||||
|
return info
|
||||||
|
|
||||||
self.imagename = ''.join([self.rootname, '.png'])
|
self.imagename = ''.join([self.rootname, '.png'])
|
||||||
gs_call = [
|
gs_call = [
|
||||||
"-q", "-sDEVICE=png16m", "-o", self.imagename, "-r600", self.filename
|
'-q',
|
||||||
|
'-sDEVICE=png16m',
|
||||||
|
'-o',
|
||||||
|
self.imagename,
|
||||||
|
'-r600',
|
||||||
|
self.filename
|
||||||
]
|
]
|
||||||
if "ghostscript" in subprocess.check_output(["gs", "-version"]).decode('utf-8').lower():
|
info = get_platform()
|
||||||
gs_call.insert(0, "gs")
|
if info['system'] == 'windows':
|
||||||
|
bit = info['machine'][-2:]
|
||||||
|
gs_call.insert(0, 'gswin{}c.exe'.format(bit))
|
||||||
else:
|
else:
|
||||||
gs_call.insert(0, "gsc")
|
if 'ghostscript' in subprocess.check_output(['gs', '-version']).decode('utf-8').lower():
|
||||||
|
gs_call.insert(0, 'gs')
|
||||||
|
else:
|
||||||
|
gs_call.insert(0, 'gsc')
|
||||||
subprocess.call(gs_call, stdout=open(os.devnull, 'w'),
|
subprocess.call(gs_call, stdout=open(os.devnull, 'w'),
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,79 @@
|
||||||
Installation of Camelot
|
Installation of Camelot
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
This part of the documentation covers how to install Camelot. First, you'll need to install the dependencies, which include `tk`_ and `ghostscript`_.
|
This part of the documentation covers how to install Camelot. First, you'll need to install the dependencies, which include `Tkinter`_ and `ghostscript`_.
|
||||||
|
|
||||||
.. _tk: https://packages.ubuntu.com/trusty/python-tk
|
.. _Tkinter: https://wiki.python.org/moin/TkInter
|
||||||
.. _ghostscript: https://www.ghostscript.com/
|
.. _ghostscript: https://www.ghostscript.com
|
||||||
|
|
||||||
|
Install the dependencies
|
||||||
|
------------------------
|
||||||
|
|
||||||
These can be installed using your system's package manager. You can run one of the following, based on your OS.
|
These can be installed using your system's package manager. You can run one of the following, based on your OS.
|
||||||
|
|
||||||
For Ubuntu::
|
For Ubuntu
|
||||||
|
^^^^^^^^^^
|
||||||
|
::
|
||||||
|
|
||||||
$ apt install python-tk ghostscript
|
$ apt install python-tk ghostscript
|
||||||
|
|
||||||
.. note:: For Python 3, install python3-tk.
|
Or for Python 3::
|
||||||
|
|
||||||
For macOS::
|
$ apt install python3-tk ghostscript
|
||||||
|
|
||||||
|
For macOS
|
||||||
|
^^^^^^^^^
|
||||||
|
::
|
||||||
|
|
||||||
$ brew install tcl-tk ghostscript
|
$ brew install tcl-tk ghostscript
|
||||||
|
|
||||||
|
For Windows
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
|
For Tkinter, you can download the `ActiveTcl Community Edition`_ from ActiveState. For ghostscript, you can get the installer at the `ghostscript downloads page`_.
|
||||||
|
|
||||||
|
After installing ghostscript, you'll need to reboot your system to make sure that the ghostscript executable's path is in the windows PATH environment variable. In case you don't want to reboot, you can manually add the ghostscript executable's path to the PATH variable, `as shown here`_.
|
||||||
|
|
||||||
|
.. _ActiveTcl Community Edition: https://www.activestate.com/activetcl/downloads
|
||||||
|
.. _ghostscript downloads page: https://www.ghostscript.com/download/gsdnld.html
|
||||||
|
.. _as shown here: https://java.com/en/download/help/path.xml
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
You can do the following checks to see if the dependencies were installed correctly.
|
||||||
|
|
||||||
|
For Tkinter
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
|
Launch Python, and then at the prompt, type::
|
||||||
|
|
||||||
|
>>> import Tkinter
|
||||||
|
|
||||||
|
Or in Python 3::
|
||||||
|
|
||||||
|
>>> import tkinter
|
||||||
|
|
||||||
|
If you have Tkinter, Python will not print an error message, and if not, you will see an ``ImportError``.
|
||||||
|
|
||||||
|
For ghostscript
|
||||||
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Run the following to check the ghostscript version.
|
||||||
|
|
||||||
|
For Ubuntu/macOS::
|
||||||
|
|
||||||
|
$ gs -version
|
||||||
|
|
||||||
|
For Windows::
|
||||||
|
|
||||||
|
C:\> gswin64c.exe -version
|
||||||
|
|
||||||
|
Or for Windows 32-bit::
|
||||||
|
|
||||||
|
C:\> gswin32c.exe -version
|
||||||
|
|
||||||
|
If you have ghostscript, you should see the ghostscript version and copyright information.
|
||||||
|
|
||||||
$ pip install camelot-py
|
$ pip install camelot-py
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue