👷♂️ Make setup.py parseable by dependabot
Hopefully at least...
This commit is contained in:
1 parent
db46b4fb6f
commit
1a37f0209c
1 file changed
+120
-128
@@ -1,15 +1,12 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
|
||||||
from distutils.command.build_py import build_py as _build_py
|
from distutils.command.build_py import build_py as _build_py
|
||||||
import os
|
import os
|
||||||
import versioneer
|
import setuptools
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "src"))
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "src"))
|
||||||
import octoprint_setuptools
|
|
||||||
import setuptools
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -113,25 +110,14 @@ EXTRA_REQUIRES = dict(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# environment specific requires
|
||||||
|
EXTRA_REQUIRES[":python_version < '3'"] = INSTALL_REQUIRES_PYTHON2
|
||||||
|
EXTRA_REQUIRES[":sys_platform == 'darwin'"] = INSTALL_REQUIRES_OSX
|
||||||
|
|
||||||
# Dependency links for any of the aforementioned dependencies
|
# Dependency links for any of the aforementioned dependencies
|
||||||
DEPENDENCY_LINKS = []
|
DEPENDENCY_LINKS = []
|
||||||
|
|
||||||
# adapted from https://hynek.me/articles/conditional-python-dependencies/
|
PACKAGE_DATA_DIRS = ['static', 'templates', 'plugins', 'translations']
|
||||||
if int(setuptools.__version__.split(".", 1)[0]) < 18:
|
|
||||||
# no bdist_wheel support for setuptools < 18 since we build universal wheels and our optional dependencies
|
|
||||||
# would get lost there
|
|
||||||
assert "bdist_wheel" not in sys.argv
|
|
||||||
|
|
||||||
# add optional dependencies for setuptools versions < 18 that don't yet support environment markers
|
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
INSTALL_REQUIRES += INSTALL_REQUIRES_PYTHON2
|
|
||||||
|
|
||||||
if sys.platform == "darwin":
|
|
||||||
INSTALL_REQUIRES += INSTALL_REQUIRES_OSX
|
|
||||||
else:
|
|
||||||
# environment markers supported
|
|
||||||
EXTRA_REQUIRES[":python_version < '3'"] = INSTALL_REQUIRES_PYTHON2
|
|
||||||
EXTRA_REQUIRES[":sys_platform == 'darwin'"] = INSTALL_REQUIRES_OSX
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------
|
||||||
# Anything below here is just command setup and general setup configuration
|
# Anything below here is just command setup and general setup configuration
|
||||||
@@ -143,49 +129,57 @@ def read_file_contents(path):
|
|||||||
with codecs.open(path, encoding="utf-8") as f:
|
with codecs.open(path, encoding="utf-8") as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
def md_to_html_build_py_factory(files, baseclass):
|
|
||||||
class md_to_html_build_py(baseclass):
|
|
||||||
files = dict()
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
print("RUNNING md_to_html_build_py")
|
|
||||||
if not self.dry_run:
|
|
||||||
for directory, files in self.files.items():
|
|
||||||
target_dir = os.path.join(self.build_lib, directory)
|
|
||||||
self.mkpath(target_dir)
|
|
||||||
|
|
||||||
for entry in files:
|
|
||||||
if isinstance(entry, tuple):
|
|
||||||
if len(entry) != 2:
|
|
||||||
continue
|
|
||||||
source, dest = entry[0], os.path.join(target_dir, entry[1])
|
|
||||||
else:
|
|
||||||
source = entry
|
|
||||||
dest = os.path.join(target_dir, source + ".html")
|
|
||||||
|
|
||||||
print("Rendering markdown from {} to {}".format(source, dest))
|
|
||||||
|
|
||||||
from markdown import markdownFromFile
|
|
||||||
markdownFromFile(input=source,
|
|
||||||
output=dest,
|
|
||||||
encoding="utf-8")
|
|
||||||
baseclass.run(self)
|
|
||||||
|
|
||||||
return type(md_to_html_build_py)(md_to_html_build_py.__name__,
|
|
||||||
(md_to_html_build_py,),
|
|
||||||
dict(files=files))
|
|
||||||
|
|
||||||
def get_cmdclass():
|
def get_cmdclass():
|
||||||
|
import versioneer
|
||||||
|
import octoprint_setuptools
|
||||||
|
|
||||||
|
def md_to_html_build_py_factory(files, baseclass):
|
||||||
|
class md_to_html_build_py(baseclass):
|
||||||
|
files = dict()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
print("RUNNING md_to_html_build_py")
|
||||||
|
if not self.dry_run:
|
||||||
|
for directory, files in self.files.items():
|
||||||
|
target_dir = os.path.join(self.build_lib, directory)
|
||||||
|
self.mkpath(target_dir)
|
||||||
|
|
||||||
|
for entry in files:
|
||||||
|
if isinstance(entry, tuple):
|
||||||
|
if len(entry) != 2:
|
||||||
|
continue
|
||||||
|
source, dest = entry[0], os.path.join(target_dir, entry[1])
|
||||||
|
else:
|
||||||
|
source = entry
|
||||||
|
dest = os.path.join(target_dir, source + ".html")
|
||||||
|
|
||||||
|
print("Rendering markdown from {} to {}".format(source, dest))
|
||||||
|
|
||||||
|
from markdown import markdownFromFile
|
||||||
|
markdownFromFile(input=source,
|
||||||
|
output=dest,
|
||||||
|
encoding="utf-8")
|
||||||
|
baseclass.run(self)
|
||||||
|
|
||||||
|
return type(md_to_html_build_py)(md_to_html_build_py.__name__,
|
||||||
|
(md_to_html_build_py,),
|
||||||
|
dict(files=files))
|
||||||
|
|
||||||
cmdclass = versioneer.get_cmdclass()
|
cmdclass = versioneer.get_cmdclass()
|
||||||
|
|
||||||
# add clean command
|
# add clean command
|
||||||
cmdclass.update(dict(clean=octoprint_setuptools.CleanCommand.for_options(source_folder="src", eggs=["OctoPrint*.egg-info"])))
|
cmdclass.update(dict(clean=octoprint_setuptools.CleanCommand.for_options(source_folder="src",
|
||||||
|
eggs=["OctoPrint*.egg-info"])))
|
||||||
|
|
||||||
# add translation commands
|
# add translation commands
|
||||||
translation_dir = "translations"
|
translation_dir = "translations"
|
||||||
pot_file = os.path.join(translation_dir, "messages.pot")
|
pot_file = os.path.join(translation_dir, "messages.pot")
|
||||||
bundled_dir = os.path.join("src", "octoprint", "translations")
|
bundled_dir = os.path.join("src", "octoprint", "translations")
|
||||||
cmdclass.update(octoprint_setuptools.get_babel_commandclasses(pot_file=pot_file, output_dir=translation_dir, pack_name_prefix="OctoPrint-i18n-", pack_path_prefix="", bundled_dir=bundled_dir))
|
cmdclass.update(octoprint_setuptools.get_babel_commandclasses(pot_file=pot_file,
|
||||||
|
output_dir=translation_dir,
|
||||||
|
pack_name_prefix="OctoPrint-i18n-",
|
||||||
|
pack_path_prefix="",
|
||||||
|
bundled_dir=bundled_dir))
|
||||||
|
|
||||||
cmdclass["build_py"] = md_to_html_build_py_factory({
|
cmdclass["build_py"] = md_to_html_build_py_factory({
|
||||||
"octoprint/templates/_data": [
|
"octoprint/templates/_data": [
|
||||||
@@ -197,86 +191,84 @@ def get_cmdclass():
|
|||||||
|
|
||||||
return cmdclass
|
return cmdclass
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
import versioneer
|
||||||
|
return versioneer.get_version()
|
||||||
|
|
||||||
def params():
|
def get_package_data(dirs):
|
||||||
name = "OctoPrint"
|
import octoprint_setuptools
|
||||||
version = versioneer.get_version()
|
return octoprint_setuptools.package_data_dirs('src/octoprint',
|
||||||
cmdclass = get_cmdclass()
|
dirs)
|
||||||
|
|
||||||
description = "The snappy web interface for your 3D printer"
|
setuptools.setup(name = "OctoPrint",
|
||||||
long_description = read_file_contents(os.path.join(here, "README.md"))
|
version = get_version(),
|
||||||
long_description_content_type = "text/markdown"
|
cmdclass = get_cmdclass(),
|
||||||
|
|
||||||
python_requires = PYTHON_REQUIRES
|
description = "The snappy web interface for your 3D printer",
|
||||||
setup_requires = SETUP_REQUIRES
|
long_description = read_file_contents(os.path.join(here, "README.md")),
|
||||||
install_requires = INSTALL_REQUIRES
|
long_description_content_type = "text/markdown",
|
||||||
extras_require = EXTRA_REQUIRES
|
|
||||||
dependency_links = DEPENDENCY_LINKS
|
|
||||||
|
|
||||||
classifiers = [
|
python_requires = PYTHON_REQUIRES,
|
||||||
"Development Status :: 5 - Production/Stable",
|
setup_requires = SETUP_REQUIRES,
|
||||||
"Environment :: Web Environment",
|
install_requires = INSTALL_REQUIRES + EXTRA_REQUIRES['develop']
|
||||||
"Framework :: Flask",
|
if os.environ.get('READTHEDOCS', None) == 'True'
|
||||||
"Intended Audience :: Developers",
|
else INSTALL_REQUIRES,
|
||||||
"Intended Audience :: Education",
|
extras_require = EXTRA_REQUIRES,
|
||||||
"Intended Audience :: End Users/Desktop",
|
dependency_links = DEPENDENCY_LINKS,
|
||||||
"Intended Audience :: Manufacturing",
|
|
||||||
"Intended Audience :: Other Audience",
|
|
||||||
"Intended Audience :: Science/Research",
|
|
||||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
|
||||||
"Natural Language :: English",
|
|
||||||
"Natural Language :: German",
|
|
||||||
"Operating System :: OS Independent",
|
|
||||||
"Programming Language :: Python",
|
|
||||||
"Programming Language :: Python :: 2",
|
|
||||||
"Programming Language :: Python :: 2.7",
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"Programming Language :: Python :: 3.6",
|
|
||||||
"Programming Language :: Python :: 3.7",
|
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: Implementation :: CPython",
|
|
||||||
"Programming Language :: JavaScript",
|
|
||||||
"Topic :: Printing",
|
|
||||||
"Topic :: System :: Monitoring"
|
|
||||||
]
|
|
||||||
author = "Gina Häußge"
|
|
||||||
author_email = "gina@octoprint.org"
|
|
||||||
url = "https://octoprint.org"
|
|
||||||
license = "GNU Affero General Public License v3"
|
|
||||||
keywords = "3dprinting 3dprinter 3d-printing 3d-printer octoprint"
|
|
||||||
|
|
||||||
project_urls={
|
classifiers = [
|
||||||
"Community Forum": "https://community.octoprint.org",
|
"Development Status :: 5 - Production/Stable",
|
||||||
"Bug Reports": "https://github.com/foosel/OctoPrint/issues",
|
"Environment :: Web Environment",
|
||||||
"Source": "https://github.com/foosel/OctoPrint",
|
"Framework :: Flask",
|
||||||
"Funding": "https://donate.octoprint.org"
|
"Intended Audience :: Developers",
|
||||||
}
|
"Intended Audience :: Education",
|
||||||
|
"Intended Audience :: End Users/Desktop",
|
||||||
|
"Intended Audience :: Manufacturing",
|
||||||
|
"Intended Audience :: Other Audience",
|
||||||
|
"Intended Audience :: Science/Research",
|
||||||
|
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||||
|
"Natural Language :: English",
|
||||||
|
"Natural Language :: German",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
"Programming Language :: Python",
|
||||||
|
"Programming Language :: Python :: 2",
|
||||||
|
"Programming Language :: Python :: 2.7",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.6",
|
||||||
|
"Programming Language :: Python :: 3.7",
|
||||||
|
"Programming Language :: Python :: 3.8",
|
||||||
|
"Programming Language :: Python :: Implementation :: CPython",
|
||||||
|
"Programming Language :: JavaScript",
|
||||||
|
"Topic :: Printing",
|
||||||
|
"Topic :: System :: Monitoring"
|
||||||
|
],
|
||||||
|
author = "Gina Häußge",
|
||||||
|
author_email = "gina@octoprint.org",
|
||||||
|
url = "https://octoprint.org",
|
||||||
|
license = "GNU Affero General Public License v3",
|
||||||
|
keywords = "3dprinting 3dprinter 3d-printing 3d-printer octoprint",
|
||||||
|
|
||||||
packages = find_packages(where="src")
|
project_urls={
|
||||||
package_dir = {
|
"Community Forum": "https://community.octoprint.org",
|
||||||
"": "src",
|
"Discord Server": "https://discord.octoprint.org",
|
||||||
}
|
"Bug Reports": "https://github.com/foosel/OctoPrint/issues",
|
||||||
package_data = {
|
"Source": "https://github.com/foosel/OctoPrint",
|
||||||
"octoprint": octoprint_setuptools.package_data_dirs('src/octoprint',
|
"Funding": "https://donate.octoprint.org"
|
||||||
['static', 'templates', 'plugins', 'translations'])
|
},
|
||||||
+ ['util/piptestballoon/setup.py']
|
|
||||||
}
|
|
||||||
|
|
||||||
include_package_data = True
|
packages = setuptools.find_packages(where="src"),
|
||||||
zip_safe = False
|
package_dir = {
|
||||||
|
"": "src",
|
||||||
|
},
|
||||||
|
package_data = {
|
||||||
|
"octoprint": get_package_data(PACKAGE_DATA_DIRS) + ['util/piptestballoon/setup.py']
|
||||||
|
},
|
||||||
|
|
||||||
if os.environ.get('READTHEDOCS', None) == 'True':
|
include_package_data = True,
|
||||||
# we can't tell read the docs to please perform a pip install -e .[develop], so we help
|
zip_safe = False,
|
||||||
# it a bit here by explicitly adding the development dependencies, which include our
|
|
||||||
# documentation dependencies
|
|
||||||
install_requires = install_requires + extras_require['develop']
|
|
||||||
|
|
||||||
entry_points = {
|
entry_points = {
|
||||||
"console_scripts": [
|
"console_scripts": [
|
||||||
"octoprint = octoprint:main"
|
"octoprint = octoprint:main"
|
||||||
]
|
]
|
||||||
}
|
})
|
||||||
|
|
||||||
return locals()
|
|
||||||
|
|
||||||
setup(**params())
|
|
||||||
Reference in new issue
Block a user