Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 12-10-2016, 09:50 PM   #1
botmtl
Enthusiast
botmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel is
 
botmtl's Avatar
 
Posts: 43
Karma: 70238
Join Date: Jun 2014
Device: none
Post Calibre on Ubuntu on Windows (WSL)

Although not apparent at first glance, this picture is calibre running on the Windows Subsystem for Linux.



Why?: Because you can
No really why?: Shit and giggles
Theoretical whys:
- test if your plugin works on linux
- use linux-only plugins (although as of this moment there is only one such plugin - recoll - and it should not be linux-only since recoll is also available on the windows platform).
- (very theoretical) I have a feeling that visual studio ptvsd will work better connecting to a linux remote debugger than it does with the source code on a local windows only environment. (more to come on that later if I manage it).

Environment:
- Windows 14965+
______________________________
/ Distributor ID: Ubuntu Description: \
| Ubuntu 16.04.1 LTS Release: 16.04 |
\ Codename: xenial /
-------------------------------------

How to do it.

Windows side:
- install VcXsrv (or Xming, but I used VcXrv)

Bash side:
- X11 forwarding
Code:
echo "export DISPLAY=:0.0" >> ~/.bashrc
- fix most dbus problems
Code:
sudo sed -i 's$<listen>.*</listen>$<listen>tcp:host=localhost,port=0</listen>$' /etc/dbus-1/session.conf
- install calibre
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get install -y calibre

- monotonic patch
for some reason, kovid's monotonic implementation crashes in this environment. replace it with pipy's own monotonic lib.
Code:
sudo mv /usr/lib/calibre/calibre/utils/monotonic.py /usr/lib/calibre/calibre/utils/monotonic.bak
sudo mv /usr/lib/calibre/calibre/utils/monotonic.pyc /usr/lib/calibre/calibre/utils/monotonic.bakc
sudo wget https://raw.githubusercontent.com/atdt/monotonic/master/monotonic.py
sudo mv monotonic.py /usr/lib/calibre/calibre/utils/monotonic.py
I mostly tested the UI. calibre-viewer, calibre-editor, calibre, etc.

There shouldn't be anything not obvious missing. I chose not to go into the obvious stuff like install xpdf to be able to view pdf files, etc.

*edited*
Forgot a part. I can totally picture Kovid's face twisting in disgust at this "patch".
In /home/wsl/calibre/src/calibre/gui2/__init__.py, comment out line 1159
#fcntl.fcntl(fd, fcntl.F_SETFD, flags | cloexec_flag | os.O_NONBLOCK)

be warned that this tiny comment is bound to have huge effects on everything from filelocking to leaking file descriptors, to making your harddrive explode (not really).

Last edited by botmtl; 12-14-2016 at 07:43 PM.
botmtl is offline   Reply With Quote
Old 12-10-2016, 10:00 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Cute -- although the thing I'd be most worried about is filesystem operations. calibre pushes filesystems hard and its quite likely that the filesystem semantics of WSL do not fully match those of linux. So you could end up with data loss/corruption in your calibre library.

Also note that ctypes based implementations of monotonic are *much* slower than native ones, which is why I dont use them.
kovidgoyal is offline   Reply With Quote
Old 12-14-2016, 06:45 PM   #3
botmtl
Enthusiast
botmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel is
 
botmtl's Avatar
 
Posts: 43
Karma: 70238
Join Date: Jun 2014
Device: none
Quote:
So you could end up with data loss/corruption in your calibre library.
anyone running in this environment should expect as much. besides the whole idea of running calibre on wsl is idiotic, but I like to play around in that environment.

I think Microsoft is on to something with wsl. And thankfully they are not google, they won't drop the project in beta and say "oh well, that's that".
botmtl is offline   Reply With Quote
Old 12-14-2016, 07:16 PM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,565
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by botmtl View Post
I think Microsoft is on to something with wsl. And thankfully they are not google, they won't drop the project in beta and say "oh well, that's that".
You mean like they didn't drop BOB and WinFS not to mention AutoCollage and SPOT ... I still have the last two -- somewhere

BR
BetterRed is offline   Reply With Quote
Old 12-15-2016, 12:07 PM   #5
botmtl
Enthusiast
botmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel isbotmtl really knows where his or her towel is
 
botmtl's Avatar
 
Posts: 43
Karma: 70238
Join Date: Jun 2014
Device: none
Quote:
Originally Posted by BetterRed View Post
You mean like they didn't drop BOB and WinFS not to mention AutoCollage and SPOT ... I still have the last two -- somewhere

BR
Exactly. Even what are obvious failures gets continued support, Microsoft gets a big thumbs up from me for that. If you develop something with their stuff, you are almost certain your project will live out it's usefulness and not just stop working because the backend service got dropped.

Contrast that to google. Let's recap just a few of their dropped projects (this list is by no means complete) :
  • Picassa
  • Google Helpout
  • Google Moderator
  • Google Glass
  • Google Voice (soon)
  • Google Answers
  • Lively
  • Reader
  • Deskbar
  • Click-to-Call
  • Writely
  • Hello
  • Send to Phone
  • Audio Ads
  • Google Catalogs
  • Dodgeball
  • Ride Finder
  • Shared Stuff
  • Page Creator
  • Marratech
  • Goog-411
  • Google Labs
  • Google Buzz
  • Powermeter
  • Real Estate
  • Google Directory
  • Google Sets
  • Fast Flip
  • Image Labeler
  • Aardvark
  • Google Gears
  • Google Bookmarks
  • Google Notebook
  • Google Code Search
  • News Badges
  • Google Related
  • Latitude
  • Flu Vaccine Finder
  • Knol
  • One Pass
  • Listen
  • Slide
  • Building Maker
  • Meebo
  • Talk
  • SMS
  • iGoogle
  • Schemer
  • Notifier
  • Orkut
  • Hotpot
  • Music Trends
  • Refine
  • SearchWiki
  • US Government Search
  • Sparrow
  • Web Accelerator
  • Google Accelerator
  • Accessible Search
  • Google Video
  • Helpouts
  • Friend Connect
  • Google Radio Ads
  • Jaiku
  • SideWiki
  • Wave
botmtl is offline   Reply With Quote
Old 12-15-2016, 02:05 PM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,954
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by botmtl View Post
I think Microsoft is on to something with wsl. And thankfully they are not google, they won't drop the project in beta and say "oh well, that's that".
Never say never. MS has dropped it's share of projects.

The one thing MS dropped that caused the most outrage & sadness is when they killed off Clippy.
JSWolf is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF to TXT, Windows vs Ubuntu? jayr Conversion 5 05-10-2016 09:02 PM
Ubuntu userland running on Windows 10 kacir News 22 04-10-2016 08:45 AM
Ubuntu Headless, Windows 8.1 and database malformation (Cygwin?) Kouwezakkie Devices 2 03-01-2015 01:56 PM
news works in windows but not in ubuntu butitsmyname Calibre 1 12-09-2010 01:29 PM
Seriously thoughtful Should I switch to Ubuntu, or stay with Windows XP? frabjous Lounge 197 06-15-2009 05:21 AM


All times are GMT -4. The time now is 03:08 PM.


MobileRead.com is a privately owned, operated and funded community.