diff --git a/.gitignore b/.gitignore index e69de29..e8ada09 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/lulzbot-14.12.tar.gz diff --git a/cura-lulzbot b/cura-lulzbot new file mode 100744 index 0000000..e19defd --- /dev/null +++ b/cura-lulzbot @@ -0,0 +1,5 @@ +#!/usr/bin/python +import os +os.chdir("/usr/lib/python2.7/site-packages/") +import CuraLulzbot.cura as cura +cura.main() diff --git a/cura-lulzbot-no-firmware.patch b/cura-lulzbot-no-firmware.patch new file mode 100644 index 0000000..5db0b98 --- /dev/null +++ b/cura-lulzbot-no-firmware.patch @@ -0,0 +1,56 @@ +diff --git a/Cura/gui/firmwareInstall.py b/Cura/gui/firmwareInstall.py +index 4dd751e..7fcbf96 100644 +--- a/Cura/gui/firmwareInstall.py ++++ b/Cura/gui/firmwareInstall.py +@@ -17,42 +17,6 @@ from Cura.util import profile + from Cura.util import resources + + def getDefaultFirmware(machineIndex = None): +- if profile.getMachineSetting('machine_type', machineIndex) == 'ultimaker': +- name = 'MarlinUltimaker' +- if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 2: +- return None +- if profile.getMachineSetting('has_heated_bed', machineIndex) == 'True': +- name += '-HBK' +- if sys.platform.startswith('linux'): +- name += '-115200' +- else: +- name += '-250000' +- if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 1: +- name += '-dual' +- return resources.getPathForFirmware(name + '.hex') +- +- if profile.getMachineSetting('machine_type', machineIndex) == 'ultimaker_plus': +- name = 'MarlinUltimaker-UMOP' +- if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 2: +- return None +- if sys.platform.startswith('linux'): +- name += '-115200' +- else: +- name += '-250000' +- if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 1: +- name += '-dual' +- return resources.getPathForFirmware(name + '.hex') +- +- if profile.getMachineSetting('machine_type', machineIndex) == 'ultimaker2': +- if profile.getMachineSettingFloat('extruder_amount', machineIndex) > 2: +- return None +- if profile.getMachineSettingFloat('extruder_amount', machineIndex) == 2: +- return resources.getPathForFirmware("MarlinUltimaker2-dual.hex") +- return resources.getPathForFirmware("MarlinUltimaker2.hex") +- if profile.getMachineSetting('machine_type', machineIndex) == 'lulzbot_mini': +- return resources.getPathForFirmware("marlin_mini_2014Q4.hex") +- if profile.getMachineSetting('machine_type', machineIndex) == 'Witbox': +- return resources.getPathForFirmware("MarlinWitbox.hex") + return None + + class InstallFirmware(wx.Dialog): +@@ -63,7 +27,7 @@ class InstallFirmware(wx.Dialog): + if filename is None: + filename = getDefaultFirmware(machineIndex) + if filename is None: +- wx.MessageBox(_("I am sorry, but Cura does not ship with a default firmware for your machine configuration."), _("Firmware update"), wx.OK | wx.ICON_ERROR) ++ wx.MessageBox(_("I am sorry, but Cura on Fedora does not ship firmware for legal and technical reasons. Go download it and install it as custom firmware instead."), _("Firmware update"), wx.OK | wx.ICON_ERROR) + self.Destroy() + return + self._machine_type = profile.getMachineSetting('machine_type', machineIndex) diff --git a/cura-lulzbot-system-paths.patch b/cura-lulzbot-system-paths.patch new file mode 100644 index 0000000..84a7959 --- /dev/null +++ b/cura-lulzbot-system-paths.patch @@ -0,0 +1,60 @@ +diff --git a/Cura/util/pluginInfo.py b/Cura/util/pluginInfo.py +index eba3770..5810312 100644 +--- a/Cura/util/pluginInfo.py ++++ b/Cura/util/pluginInfo.py +@@ -80,14 +80,7 @@ def setPostProcessPluginConfig(config): + profile.putProfileSetting('plugin_config', pickle.dumps(config)) + + def getPluginBasePaths(): +- ret = [] +- if platform.system() != "Windows": +- ret.append(os.path.expanduser('~/.cura/plugins/')) +- if platform.system() == "Darwin" and hasattr(sys, 'frozen'): +- ret.append(os.path.normpath(os.path.join(resources.resourceBasePath, "plugins"))) +- else: +- ret.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', 'plugins'))) +- return ret ++ return [os.path.expanduser('~/.cura-lulzbot/plugins/'), '/usr/share/cura-lulzbot/plugins'] + + def getPluginList(pluginType): + global _pluginList +diff --git a/Cura/util/profile.py b/Cura/util/profile.py +index ec84bb4..f645c9a 100644 +--- a/Cura/util/profile.py ++++ b/Cura/util/profile.py +@@ -608,11 +608,11 @@ def getBasePath(): + :return: The path in which the current configuration files are stored. This depends on the used OS. + """ + if platform.system() == "Windows": +- basePath = os.path.normpath(os.path.expanduser('~/.cura/%s' % version.getVersion(False))) ++ basePath = os.path.normpath(os.path.expanduser('~/.cura-lulzbot/%s' % version.getVersion(False))) + elif platform.system() == "Darwin": + basePath = os.path.expanduser('~/Library/Application Support/Cura/%s' % version.getVersion(False)) + else: +- basePath = os.path.expanduser('~/.cura/%s' % version.getVersion(False)) ++ basePath = os.path.expanduser('~/.cura-lulzbot/%s' % version.getVersion(False)) + if not os.path.isdir(basePath): + try: + os.makedirs(basePath) +diff --git a/Cura/util/resources.py b/Cura/util/resources.py +index d92eb2a..64db336 100644 +--- a/Cura/util/resources.py ++++ b/Cura/util/resources.py +@@ -27,7 +27,7 @@ if sys.platform.startswith('darwin'): + else: + resourceBasePath = os.path.join(os.path.dirname(__file__), "../../resources") + else: +- resourceBasePath = os.path.join(os.path.dirname(__file__), "../../resources") ++ resourceBasePath = "/usr/share/cura-lulzbot" + + def getPathForResource(dir, subdir, resource_name): + assert os.path.isdir(dir), "{p} is not a directory".format(p=dir) +@@ -59,7 +59,7 @@ def setupLocalization(selectedLanguage = None): + languages = [item[0]] + + locale_path = os.path.normpath(os.path.join(resourceBasePath, 'locale')) +- translation = gettext.translation('Cura', locale_path, languages, fallback=True) ++ translation = gettext.translation('CuraLulzbot', locale_path, languages, fallback=True) + #translation.ugettext = lambda message: u'#' + message + translation.install(unicode=True) + diff --git a/cura-lulzbot-version.patch b/cura-lulzbot-version.patch new file mode 100644 index 0000000..843a3a3 --- /dev/null +++ b/cura-lulzbot-version.patch @@ -0,0 +1,77 @@ +diff --git a/Cura/util/version.py b/Cura/util/version.py +index d9f63a8..add5eb0 100644 +--- a/Cura/util/version.py ++++ b/Cura/util/version.py +@@ -17,70 +17,12 @@ except: + from Cura.util import resources + + def getVersion(getGitVersion = True): +- gitPath = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../..")) +- if hasattr(sys, 'frozen'): +- versionFile = os.path.normpath(os.path.join(resources.resourceBasePath, "version")) +- else: +- versionFile = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../version")) +- +- if getGitVersion: +- try: +- gitProcess = subprocess.Popen(args = "git show -s --pretty=format:%H", shell = True, cwd = gitPath, stdout = subprocess.PIPE, stderr = subprocess.PIPE) +- (stdoutdata, stderrdata) = gitProcess.communicate() +- +- if gitProcess.returncode == 0: +- return stdoutdata +- except: +- pass +- +- gitHeadFile = gitPath + "/.git/refs/heads/SteamEngine" +- if os.path.isfile(gitHeadFile): +- if not getGitVersion: +- return "dev" +- f = open(gitHeadFile, "r") +- version = f.readline() +- f.close() +- return version.strip() +- if os.path.exists(versionFile): +- f = open(versionFile, "r") +- version = f.readline() +- f.close() +- return version.strip() +- versionFile = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../../version")) +- if os.path.exists(versionFile): +- f = open(versionFile, "r") +- version = f.readline() +- f.close() +- return version.strip() +- return "UNKNOWN" #No idea what the version is. TODO:Tell the user. ++ return "REPLACE_THIS_IN_SPEC" + + def isDevVersion(): +- gitPath = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../../.git")) +- hgPath = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../../.hg")) +- return os.path.exists(gitPath) or os.path.exists(hgPath) ++ return False + + def checkForNewerVersion(): +- if isDevVersion(): +- return None +- try: +- updateBaseURL = '' +- localVersion = map(int, getVersion(False).split('.')) +- while len(localVersion) < 3: +- localVersion += [1] +- latestFile = urllib2.urlopen("%s/latest.xml" % (updateBaseURL)) +- latestXml = latestFile.read() +- latestFile.close() +- xmlTree = ElementTree.fromstring(latestXml) +- for release in xmlTree.iter('release'): +- os = str(release.attrib['os']) +- version = [int(release.attrib['major']), int(release.attrib['minor']), int(release.attrib['revision'])] +- filename = release.find("filename").text +- if platform.system() == os: +- if version > localVersion: +- return "%s/current/%s" % (updateBaseURL, filename) +- except: +- #print sys.exc_info() +- return None + return None + + if __name__ == '__main__': diff --git a/cura-lulzbot.desktop b/cura-lulzbot.desktop new file mode 100644 index 0000000..57d73bb --- /dev/null +++ b/cura-lulzbot.desktop @@ -0,0 +1,9 @@ + +[Desktop Entry] +Name=Cura Lulzbot Edition +GenericName=3D Printer Interface +Exec=cura-lulzbot +Icon=/usr/share/pixmaps/cura-lulzbot.ico +Terminal=false +Type=Application +Categories=Graphics; diff --git a/cura-lulzbot.spec b/cura-lulzbot.spec new file mode 100644 index 0000000..a33afca --- /dev/null +++ b/cura-lulzbot.spec @@ -0,0 +1,119 @@ +Name: cura-lulzbot +Version: 14.12 +Release: 1%{?dist} +Summary: Cura LulzBot Edition, 3D printer control software + +# Code is AGPLv3 +# Example models are CC-BY-SA +License: AGPLv3 and CC-BY-SA + +URL: https://www.lulzbot.com/cura + +Source0: https://github.com/alephobjects/Cura/archive/lulzbot-%{version}.tar.gz +Source1: %{name} +Source2: %{name}.desktop + +# Use system paths and make it parallel installable with cura +Patch1: %{name}-system-paths.patch + +# Rework the logic of determining the version (didn't work) +Patch2: %{name}-version.patch + +# Disable installation of firmwares Fedora doesn't ship +Patch3: %{name}-no-firmware.patch + +BuildArch: noarch +BuildRequires: python2-devel +BuildRequires: dos2unix +BuildRequires: desktop-file-utils +BuildRequires: gettext +Requires: PyOpenGL +Requires: wxPython +Requires: pyserial +Requires: numpy +Requires: python-power +Requires: pypy +Requires: CuraEngine >= 14.12.1 + +%description +The default software for the LulzBot Mini 3D printer is called Cura LulzBot +Edition. Cura is a Free Software program that both prepares your files for +printing (by converting your model into GCODE), and also allows you to control +the operation of your LulzBot 3D printer. + + +%prep +%setup -qn Cura-lulzbot-%{version} +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 + +dos2unix resources/example/Attribution.txt + +sed -i 's/REPLACE_THIS_IN_SPEC/%{version}/' Cura/util/version.py + +# remove shebang +sed -i '1d' Cura/cura.py +sed -i '1d' Cura/util/pymclevel/mce.py + +# Remove firmware +rm resources/firmware/* + +# Rename icon +mv resources/cura{,-lulzbot}.ico + +# Relocate imports - don't write patch for this, as this sed needs no rebasing ;) +find -name \*.py -exec sed -i \ + -e 's/from Cura import/from CuraLulzbot import/g' \ + -e 's/from Cura\./from CuraLulzbot./g' \ + -e 's/import Cura/import CuraLulzbot/g' {} \; + +%build +# rebuild locales +cd resources/locale +mv po pl # polish code was wrong +rm *.in *.pot +for FILE in *; do + rm $FILE/LC_MESSAGES/Cura.mo + msgfmt $FILE/LC_MESSAGES/Cura.po -o $FILE/LC_MESSAGES/CuraLulzbot.mo + rm $FILE/LC_MESSAGES/Cura.po +done +cd - + +%install +mkdir -p %{buildroot}%{python_sitelib}/CuraLulzbot +mkdir -p %{buildroot}%{_datadir}/%{name} +mkdir -p %{buildroot}%{_datadir}/pixmaps +mkdir -p %{buildroot}%{_datadir}/locale +mkdir -p %{buildroot}%{_bindir} + +cp -apr Cura/* %{buildroot}%{python_sitelib}/CuraLulzbot +rm -rf %{buildroot}%{python_sitelib}/CuraLulzbot/LICENSE +cp -apr resources/* %{buildroot}%{_datadir}/%{name} +cp -apr plugins %{buildroot}%{_datadir}/%{name} +cp -ap %{SOURCE1} %{buildroot}%{_bindir} +ln -s %{_datadir}/%{name} %{buildroot}%{python_sitelib}/CuraLulzbot/resources +ln -s %{_datadir}/%{name}/%{name}.ico %{buildroot}%{_datadir}/pixmaps + +# locales +cp -ar %{buildroot}%{_datadir}/%{name}/locale/* %{buildroot}%{_datadir}/locale +rm -rf %{buildroot}%{_datadir}/%{name}/locale +ln -s -f %{_datadir}/locale/ %{buildroot}%{_datadir}/%{name}/ # the app expects the locale folder in here + +desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE2} + +%{find_lang} CuraLulzbot + +%files -f CuraLulzbot.lang +%license Cura/LICENSE resources/example/Attribution.txt +%doc changelog +%{python_sitelib}/CuraLulzbot +%{_datadir}/%{name} +%{_datadir}/pixmaps/%{name}.ico +%{_datadir}/applications/%{name}.desktop +%{_bindir}/%{name} + +%changelog +* Wed Feb 04 2015 Miro HronĨok - 14.12-1 +- Initial package (started as cura.spec fork) + diff --git a/sources b/sources index e69de29..f424796 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +0dd64ca5000ecd4bff04ac532900f8c5 lulzbot-14.12.tar.gz