11# coding=utf-8
22from setuptools import setup , Extension
3- from distutils .command .build_ext import build_ext
4- from distutils .ccompiler import CCompiler
5- from distutils .unixccompiler import UnixCCompiler
6- from distutils .msvccompiler import MSVCCompiler
7- from distutils .bcppcompiler import BCPPCompiler
8- from distutils .cygwinccompiler import CygwinCCompiler
9- from distutils .version import LooseVersion
10- from octoprint_octolapse_setuptools import NumberedVersion
3+ from setuptools .command .build_ext import build_ext
114import sys
125import versioneer
6+ import configparser # Ändere hier den Import
7+
138########################################################################################################################
149# The plugin's identifier, has to be unique
1510plugin_identifier = "octolapse"
16- # The plugin's python package, should be "octoprint_<plugin identifier>", has to be unique
1711plugin_package = "octoprint_octolapse"
18- # The plugin's human readable name. Can be overwritten within OctoPrint's internal data via __plugin_name__ in the
19- # plugin module
2012plugin_name = "Octolapse"
21- # The plugin's fallback version, in case versioneer can't extract the version from _version.py.
22- # This can happen if the user installs from one of the .zip links in github, not generated with git archive
23- fallback_version = NumberedVersion .clean_version (NumberedVersion .CurrentVersion )
24- # Get the cleaned version number from versioneer
25- plugin_version = NumberedVersion .clean_version (versioneer .get_versions (verbose = True )["version" ])
26-
27- # Depending on the installation method, versioneer might not know the current version
28- # if plugin_version == "0+unknown" or NumberedVersion(plugin_version) < NumberedVersion(fallback_version):
29- if plugin_version == "0+unknown" :
30- plugin_version = fallback_version
31- try :
32- # This generates version in the following form:
33- # 0.4.0rc1+?.GUID_GOES_HERE
34- plugin_version += "+u." + versioneer .get_versions ()['full-revisionid' ][0 :7 ]
35- except :
36- pass
13+ fallback_version = "1.0.0"
14+ plugin_version = versioneer .get_versions ()["version" ]
3715
3816plugin_cmdclass = versioneer .get_cmdclass ()
39- # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
40- # module
41- plugin_description = """Create stabilized timelapses of your 3d prints. Highly customizable, loads of presets, lots of fun."""
42- # The plugin's author. Can be overwritten within OctoPrint's internal data via __plugin_author__ in the plugin module
17+ plugin_description = """Create stabilized timelapses of your 3d prints. Highly customizable, loads of presets, lots of fun."""
4318plugin_author = "Brad Hochgesang"
44- # The plugin's author's mail address.
4519plugin_author_email = "FormerLurker@pm.me"
46-
47- # The plugin's homepage URL. Can be overwritten within OctoPrint's internal data via __plugin_url__ in the plugin module
4820plugin_url = "https://github.com/FormerLurker/Octolapse"
49-
50- # The plugin's license. Can be overwritten within OctoPrint's internal data via __plugin_license__ in the plugin module
5121plugin_license = "AGPLv3"
52-
53- # Any additional requirements besides OctoPrint should be listed here
54- plugin_requires = ["pillow>=9.3,<11" , "sarge" , "six" , "OctoPrint>=1.4.0" , "psutil" , "file_read_backwards" ,
55- "setuptools>=6.0" , "awesome-slugify>=1.6.5,<1.7" ]
56-
57- import octoprint .server
58- if LooseVersion (octoprint .server .VERSION ) < LooseVersion ("1.4" ):
59- plugin_requires .extend (["flask_principal>=0.4,<1.0" ])
60-
61- # enable faulthandler for python 3.
62- if (3 , 0 ) < sys .version_info < (3 , 3 ):
63- print ("Adding faulthandler requirement." )
64- plugin_requires .append ("faulthandler>=3.1" )
65-
66- # TODO: Get fontconfig to work
67- #from sys import platform
68- #if platform == "linux" or platform == "linux2":
69- # plugin_requires.append("enum34")
70- # plugin_requires.append("fontconfig")
22+ plugin_requires = ["pillow>=9.3,<11" , "sarge" , "six" , "OctoPrint>=1.4.0" , "psutil" , "file_read_backwards" , "setuptools>=6.0" , "awesome-slugify>=1.6.5,<1.7" ]
7123
7224# --------------------------------------------------------------------------------------------------------------------
7325# More advanced options that you usually shouldn't have to touch follow after this point
74- # --------------------------------------d------------------------------------------------------------------------------
7526
76- # Additional package data to install for this plugin. The subfolders "templates", "static" and "translations" will
77- # already be installed automatically if they exist. Note that if you add something here you'll also need to update
78- # MANIFEST.in to match to ensure that python setup.py sdist produces a source distribution that contains all your
79- # files. This is sadly due to how python's setup.py works, see also http://stackoverflow.com/a/14159430/2028598
8027plugin_additional_data = [
8128 'data/*.json' ,
8229 'data/images/*.png' ,
8633 'data/webcam_types/*' ,
8734 'data/fonts/*'
8835]
89- # Any additional python packages you need to install with your plugin that are not contained in <plugin_package>.*
9036plugin_additional_packages = ['octoprint_octolapse_setuptools' ]
91-
92- # Any python packages within <plugin_package>.* you do NOT want to install with your plugin
9337plugin_ignored_packages = []
9438
9539# C++ Extension compiler options
96- # Set debug mode
9740DEBUG = False
98- # define compiler flags
9941compiler_opts = {
100- CCompiler .compiler_type : {
101- 'extra_compile_args' : ['-O3' , '-std=c++11' ],
102- 'extra_link_args' : [],
103- 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
104- },
105- MSVCCompiler .compiler_type : {
106- 'extra_compile_args' : ['/O2' , '/fp:fast' , '/GL' , '/analyze' , '/Gy' , '/MD' , '/EHsc' ],
107- 'extra_link_args' : [],
108- 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
109- },
110- UnixCCompiler .compiler_type : {
111- 'extra_compile_args' : ['-O3' , '-std=c++11' ],
112- 'extra_link_args' : [],
113- 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
114- },
115- BCPPCompiler .compiler_type : {
116- 'extra_compile_args' : ['-O3' , '-std=c++11' ],
117- 'extra_link_args' : [],
118- 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
119- },
120- CygwinCCompiler .compiler_type : {
121- 'extra_compile_args' : ['-O3' , '-std=c++11' ],
122- 'extra_link_args' : [],
123- 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
124- }
42+ 'extra_compile_args' : ['-O3' , '-std=c++11' ],
43+ 'extra_link_args' : [],
44+ 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
12545}
12646
12747if DEBUG :
12848 compiler_opts = {
129- CCompiler .compiler_type : {
130- 'extra_compile_args' : [],
131- 'extra_link_args' : [],
132- 'define_macros' : [('DEBUG_chardet' , '1' ), ('IS_PYTHON_EXTENSION' , '1' )]
133- },
134- MSVCCompiler .compiler_type : {
135- 'extra_compile_args' : ['/EHsc' , '/Z7' ],
136- 'extra_link_args' : ['/DEBUG' ],
137- 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
138- },
139- UnixCCompiler .compiler_type : {
140- 'extra_compile_args' : ['-g' ],
141- 'extra_link_args' : ['-g' ],
142- 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
143- },
144- BCPPCompiler .compiler_type : {
145- 'extra_compile_args' : [],
146- 'extra_link_args' : [],
147- 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
148- },
149- CygwinCCompiler .compiler_type : {
150- 'extra_compile_args' : [],
151- 'extra_link_args' : [],
152- 'define_macros' : [('IS_PYTHON_EXTENSION' , '1' )]
153- }
49+ 'extra_compile_args' : [],
50+ 'extra_link_args' : [],
51+ 'define_macros' : [('DEBUG_chardet' , '1' ), ('IS_PYTHON_EXTENSION' , '1' )]
15452 }
15553
15654class build_ext_subclass (build_ext ):
15755 def build_extensions (self ):
15856 print ("Compiling Octolapse Parser Extension with {0}." .format (self .compiler ))
15957
160- c = self .compiler
161- opts = [v for k , v in compiler_opts .items () if c .compiler_type == k ]
162- for e in self .extensions :
163- for o in opts :
164- for attrib , value in o .items ():
165- getattr (e , attrib ).extend (value )
58+ for ext in self .extensions :
59+ ext .extra_compile_args .extend (compiler_opts ['extra_compile_args' ])
60+ ext .extra_link_args .extend (compiler_opts ['extra_link_args' ])
61+ ext .define_macros .extend (compiler_opts ['define_macros' ])
16662 build_ext .build_extensions (self )
16763
16864 for extension in self .extensions :
169- print ("Build Extensions for {0} - extra_compile_args:{1} - extra_link_args:{2} - define_macros:{3}" .format (
170- extension .name , extension .extra_compile_args , extension .extra_link_args , extension .define_macros )
171- )
172-
65+ print (f"Build Extensions for { extension .name } - extra_compile_args: { extension .extra_compile_args } - extra_link_args: { extension .extra_link_args } - define_macros: { extension .define_macros } " )
17366
174- ## Build our c ++ parser extension
67+ # Define the C ++ Extension
17568plugin_ext_sources = [
17669 'octoprint_octolapse/data/lib/c/gcode_position_processor.cpp' ,
17770 'octoprint_octolapse/data/lib/c/gcode_parser.cpp' ,
@@ -198,22 +91,19 @@ def build_extensions(self):
19891 language = "c++"
19992)
20093
201-
20294additional_setup_parameters = {
20395 "ext_modules" : [cpp_gcode_parser ],
20496 "cmdclass" : {"build_ext" : build_ext_subclass }
20597}
20698
207- ########################################################################################################################
99+ # Ensure OctoPrint's setuptools is available
208100try :
209101 import octoprint_setuptools
210- except :
211- print ("Could not import OctoPrint's setuptools, are you sure you are running that under "
212- "the same python installation that OctoPrint is installed under?" )
213- import sys
214-
102+ except ImportError :
103+ print ("Could not import OctoPrint's setuptools, are you sure you are running under the correct Python environment?" )
215104 sys .exit (- 1 )
216105
106+ # Generate the setup parameters
217107setup_parameters = octoprint_setuptools .create_plugin_setup_parameters (
218108 identifier = plugin_identifier ,
219109 package = plugin_package ,
@@ -231,8 +121,10 @@ def build_extensions(self):
231121 cmdclass = plugin_cmdclass
232122)
233123
124+ # Merge additional setup parameters
234125if len (additional_setup_parameters ):
235126 from octoprint .util import dict_merge
236127 setup_parameters = dict_merge (setup_parameters , additional_setup_parameters )
237128
129+ # Run the setup function
238130setup (** setup_parameters )
0 commit comments