2016-07-11 23:01:57 +02:00
|
|
|
#!/usr/bin/env python3
|
2016-03-26 11:12:14 +01:00
|
|
|
|
2017-05-05 07:59:50 +02:00
|
|
|
import glob
|
|
|
|
import os
|
2018-04-15 11:51:49 +02:00
|
|
|
import sys
|
2018-10-27 19:03:09 +02:00
|
|
|
from subprocess import check_output, CalledProcessError
|
2016-03-26 11:12:14 +01:00
|
|
|
from setuptools import setup, find_packages
|
2017-02-25 20:01:03 +01:00
|
|
|
from setuptools.command.build_py import build_py
|
2017-05-05 07:59:50 +02:00
|
|
|
|
2017-02-25 20:01:03 +01:00
|
|
|
|
|
|
|
class CustomBuildExtCommand(build_py):
|
|
|
|
"""Customized setuptools install command - prints a friendly greeting."""
|
|
|
|
|
|
|
|
def buildInkscapeExt(self):
|
2018-04-15 11:51:49 +02:00
|
|
|
os.system("%s %s %s" % (sys.executable,
|
|
|
|
os.path.join("scripts", "boxes2inkscape"),
|
|
|
|
"inkex"))
|
2017-02-25 20:01:03 +01:00
|
|
|
|
|
|
|
def run(self):
|
|
|
|
self.execute(self.buildInkscapeExt, ())
|
2018-10-27 19:03:09 +02:00
|
|
|
try:
|
2018-11-25 23:33:12 +01:00
|
|
|
path = check_output(["inkscape", "-x"]).decode().strip()
|
2018-10-27 19:03:09 +02:00
|
|
|
if not os.access(path, os.W_OK): # Can we install globaly
|
|
|
|
# Not tested on Windows and Mac
|
|
|
|
path = os.path.expanduser("~/.config/inkscape/extensions")
|
|
|
|
|
2017-02-25 20:01:03 +01:00
|
|
|
if self.distribution.data_files is None:
|
|
|
|
self.distribution.data_files = []
|
|
|
|
self.distribution.data_files.append(
|
2018-07-24 20:38:34 +02:00
|
|
|
(path,
|
2017-05-05 07:59:50 +02:00
|
|
|
[i for i in glob.glob(os.path.join("inkex", "*.inx"))]))
|
2018-08-22 17:59:18 +02:00
|
|
|
self.distribution.data_files.append((path, ['scripts/boxes']))
|
2018-10-27 19:03:09 +02:00
|
|
|
except CalledProcessError:
|
|
|
|
pass # Inkscape is not installed
|
|
|
|
|
2017-02-25 20:01:03 +01:00
|
|
|
build_py.run(self)
|
2016-03-26 11:12:14 +01:00
|
|
|
|
2017-05-05 07:59:50 +02:00
|
|
|
setup(
|
|
|
|
name='boxes',
|
|
|
|
version='0.1',
|
|
|
|
description='Boxes generator for laser cutters',
|
|
|
|
author='Florian Festi',
|
|
|
|
author_email='florian@festi.info',
|
|
|
|
url='https://github.com/florianfesti/boxes',
|
|
|
|
packages=find_packages(),
|
2019-07-02 12:12:06 +02:00
|
|
|
install_requires=['cairocffi==0.8.0', 'markdown'],
|
2017-05-05 07:59:50 +02:00
|
|
|
scripts=['scripts/boxes', 'scripts/boxesserver'],
|
|
|
|
cmdclass={
|
|
|
|
'build_py': CustomBuildExtCommand,
|
|
|
|
},
|
|
|
|
classifiers=[
|
|
|
|
"Development Status :: 4 - Beta",
|
|
|
|
"Environment :: Console",
|
|
|
|
"Environment :: Web Environment",
|
|
|
|
"Intended Audience :: Manufacturing",
|
|
|
|
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
|
|
|
"Programming Language :: Python :: 3",
|
|
|
|
"Topic :: Multimedia :: Graphics :: Editors :: Vector-Based",
|
|
|
|
"Topic :: Scientific/Engineering",
|
|
|
|
"Topic :: Scientific/Engineering :: Computer Aided Design",
|
|
|
|
],
|
|
|
|
keywords=["boxes", "box", "generator", "svg", "laser cutter"], )
|