feature request: byte-compile from commandline

Bug #821986 reported by tlroche
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Medium
Andreas Roehler

Bug Description

It Would Be Nice if you could include a script to byte-compile the elisp, since that is not working for me in the usual way. What I mean:

Normally after I install emacs "packages" (in the absence of a real emacs package manager, insert lament here) I typically download, then byte-compile from in batch mode, e.g.,

me@it:~$ URI=http://launchpad.net/python-mode/trunk/6.0.1/+download/python-mode.el-6.0.1.tar.gz
me@it:~$ pushd /home/me/.emacs.d/site-lisp/python
me@it:~/.emacs.d/site-lisp/python$ wget -O - "${URI}" | tar xfz -
me@it:~/.emacs.d/site-lisp/python$ ls -alth
...
> drwxr-xr-x 4 me me 4.0K 2011-08-01 09:16 python-mode.el-6.0.1
me@it:~/.emacs.d/site-lisp/python$ ls -alth python-mode.el-6.0.1/
> drwxr-xr-x 2 me me 4.0K 2011-08-01 09:16 completion
> -rw-r--r-- 1 me me 379 2011-08-01 09:16 PKG-INFO
> drwxr-xr-x 2 me me 4.0K 2011-08-01 09:16 test
> -rw-r--r-- 1 me me 191K 2011-08-01 09:15 python-mode.el
> -rw-r--r-- 1 me me 248 2011-08-01 07:42 NEWS-6.0.1
> -rw-r--r-- 1 me me 1.6K 2011-08-01 07:39 NEWS
> -rw-r--r-- 1 me me 478 2011-08-01 07:05 setup.py
> -rw-r--r-- 1 me me 353 2011-07-21 15:14 README
> -rw-r--r-- 1 me me 35K 2011-04-26 14:34 LICENSE
> -rw-r--r-- 1 me me 3.0K 2011-04-25 06:01 highlight-indentation.el
me@it:~/.emacs.d/site-lisp/python$ popd
me@it:~$ pushd ~/.emacs.d/site-lisp/python/python-mode.el-6.0.1
me@it:~/.emacs.d/site-lisp/python/python-mode.el-6.0.1$ find ./ -name '*.el' | wc -l
> 7
me@it:~/.emacs.d/site-lisp/python/python-mode.el-6.0.1$ find ./ -name '*.el'
> ./test/python-mode-test.el
> ./test/py-bug-numbered-tests.el
> ./test/pars-part-output.el
> ./test/doctest-mode.el
> ./highlight-indentation.el
> ./completion/pycomplete.el
> ./python-mode.el
me@it:~/.emacs.d/site-lisp/python/python-mode.el-6.0.1$ find ./ -name '*.elc' | wc -l
> 0
me@it:~/.emacs.d/site-lisp/python/python-mode.el-6.0.1$ find ./ -name '*.el' | xargs emacs -batch -f batch-byte-compile

However in this case, in addition to the usual spew, I get errors, e.g..

> py-bug-numbered-tests.el:20:1:Error: Cannot open load file: python-mode

Once finished, I see

me@it:~/.emacs.d/site-lisp/python/python-mode.el-6.0.1$ find ./ -name '*.el' | wc -l
> 7
me@it:~/.emacs.d/site-lisp/python/python-mode.el-6.0.1$ find ./ -name '*.elc' | wc -l
> 4
me@it:~/.emacs.d/site-lisp/python/python-mode.el-6.0.1$ find ./ -name '*.elc'
./test/python-mode-test.elc
./test/pars-part-output.elc
./test/doctest-mode.elc
./highlight-indentation.elc

I then hafta get into emacs and `M-x byte-compile-file` a bit until I get

tlroche@tlrPanP5:~/.emacs.d/site-lisp/python/python-mode.el-6.0.1$ find ./ -name '*.elc'
> ./test/python-mode-test.elc
> ./test/pars-part-output.elc
> ./test/doctest-mode.elc
> ./completion/pycomplete.elc
> ./highlight-indentation.elc
> ./python-mode.elc

(I still can't get py-bug-numbered-tests.el to byte-compile.) I'm assuming these results indicate that one must byte-compile the files in a certain order, or with certain other instructions. Am I missing something? If not, it would be nice if, e.g., you could include an executable script for byte-compiling the files, e.g., via

$ emacs -batch -l ./your_file_here.el

TIA, Tom Roche <email address hidden>

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → Medium
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Hi,

when byte-compiling from the command line, I'm using the following:

    $EMACS -Q --batch --eval "(message (emacs-version))" --eval "(when (featurep 'python-mode)(unload-feature 'python-mode t))" --eval "(add-to-list 'load-path \"$PFW/\")" -load "$PFW/python-mode.el" -load "$PFW/$TESTFILE" -load "$PFW/$TESTFILE2" -load $CCCMDS --eval "(byte-compile-file (expand-file-name \"~OTHER_PATH/test/py-bug-numbered-tests.el\"))" --eval "(byte-compile-file (expand-file-name \"~OTHER_PATH/test/python-mode-test.el\"))"

where $PFW etc. are path-variables

HTH,

Andreas

Changed in python-mode:
status: New → In Progress
milestone: none → 6.1
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Hi,

wrote and added a

byte-compile-directory.sh

which should do what you are looking for

it's here:

http://bazaar.launchpad.net/~python-mode-devs/python-mode/python-mode/view/head:/byte-compile-directory.sh

Cheers,

Andreas

Changed in python-mode:
status: In Progress → Fix Committed
Revision history for this message
tlroche (tom-roche) wrote :

I'm having 2 problems with byte-compile-directory.sh and python-mode.el-6.0.2:

1 byte-compile-directory.sh is not included with python-mode.el-6.0.2 (shouldn't it be?)
2 byte-compile-directory.sh abends on not finding pymacs/pymacs.el (which is not included, either)

How I reproduced:

VERSION="6.0.2"
PKG_URI="http://launchpad.net/python-mode/trunk/${VERSION}/+download/python-mode.el-${VERSION}.tar.gz"
BCD_URI="http://bazaar.launchpad.net/~python-mode-devs/python-mode/python-mode/download/head:/bytecompiledirectory-20110807183508-3zdf7fxpxvabeveb-1/byte-compile-directory.sh"
BCD_FN="$(basename ${BCD_URI})"
MY_SITE_LISP="${HOME}/.emacs.d/site-lisp"
ROOT_DIR="${MY_SITE_LISP}/python"
VERSION_DIR="${ROOT_DIR}/python-mode.el-${VERSION}"
for CMD in \
  "pushd ${ROOT_DIR}" \
  "wget -O - ${PKG_URI} | tar xfz -" \
  "popd" \
  "pushd ${VERSION_DIR}" \
  "wget ${BCD_URI}" \
  "chmod 755 ./${BCD_FN}" \
  "find ./ -name '*.el' | wc -l" \
  "find ./ -name '*.elc' | wc -l" \
  "./${BCD_FN}" \
  "find ./ -name '*.el' | wc -l" \
  "find ./ -name '*.elc' | wc -l" \
  "popd" \
; do
  echo -e "${CMD}"
  eval "${CMD}"
done

produces

> pushd /home/me/.emacs.d/site-lisp/python
> wget -O - http://launchpad.net/python-mode/trunk/6.0.2/+download/python-mode.el-6.0.2.tar.gz | tar xfz -
...
> 2011-08-27 20:55:50 (187 KB/s) - written to stdout [129958/129958]
> popd
> pushd /home/me/.emacs.d/site-lisp/python/python-mode.el-6.0.2
> wget http://bazaar.launchpad.net/~python-mode-devs/python-mode/python-mode/download/head:/bytecompiledirectory-20110807183508-3zdf7fxpxvabeveb-1/byte-compile-directory.sh
...
> 2011-08-27 20:55:50 (38.7 MB/s) - “byte-compile-directory.sh” saved [1490/1490]
> chmod 755 ./byte-compile-directory.sh
> find ./ -name '*.el' | wc -l
> 7
> find ./ -name '*.elc' | wc -l
> 2
> ./byte-compile-directory.sh
> GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4)
> of 2011-04-10 on brahms, modified by Debian
> Cannot open load file: /home/me/.emacs.d/site-lisp/python/python-mode.el-6.0.2/pymacs/pymacs.el
> find ./ -name '*.el' | wc -l
> 7
> find ./ -name '*.elc' | wc -l
> 2
> popd

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 821986] Re: feature request: byte-compile from commandline

Am 28.08.2011 03:08, schrieb tlroche:
> I'm having 2 problems with byte-compile-directory.sh and python-
> mode.el-6.0.2:
>
> 1 byte-compile-directory.sh is not included with python-mode.el-6.0.2 (shouldn't it be?)

> 2 byte-compile-directory.sh abends on not finding pymacs/pymacs.el (which is not included, either)

Hi,

made entries in the bug tracker. As related things must be fixed one by
one though, it's better to keep them separated.

BTW if further interested in bug-fixing, you could join the team. You
will be included into bug-mail by default then.

Thanks assisting,

Andreas

Revision history for this message
tlroche (tom-roche) wrote :

Tom Roche am 28.08.2011 03:08
>> 2 problems with byte-compile-directory.sh and python-mode.el-6.0.2:

>> 1 byte-compile-directory.sh is not included with python-mode.el-6.0.2
>> (shouldn't it be?)

https://bugs.launchpad.net/bugs/835865

>> 2 byte-compile-directory.sh abends on not finding pymacs/pymacs.el
>> (which is not included, either)

https://bugs.launchpad.net/bugs/835868

Andreas Röhler Sun, 28 Aug 2011 07:22:28 -0000
> made entries in the bug tracker.

Noted above.

> BTW if further interested in bug-fixing, you could join the team.

Sure, I'll do what I can. I may be starting a new job soon, for which
I'm studying a lot of R, which has 2 relevant effects:

1 Ramping-up is taking a lot of my time, but I should be able to test
  the odd python-mode candidate fix.

2 Working with ESS makes me wish Emacs provided the same level of
  support (and unified level of support) for Python as it does for R.
  (Or for that matter, as JDEE does for Java--or did, since I haven't
  worked with that for years > 6.)

HTH, Tom Roche <email address hidden>

Revision history for this message
Andreas Roehler (a-roehler) wrote :

> 2 Working with ESS makes me wish Emacs provided the same level of
> support (and unified level of support) for Python as it does for R.

Definitely. If you could list the features missed, that would help.
Listing together with a short description still more. All this into a
Blueprint starts being perfect. :)

> (Or for that matter, as JDEE does for Java--or did, since I haven't
> worked with that for years> 6.)

another point of interest

>
> HTH, Tom Roche<email address hidden>
>

it did, thanks,

Andreas

Revision history for this message
tlroche (tom-roche) wrote :
Download full text (16.5 KiB)

summary: you are definitely making progress, but

> test/python-mode-test.el:27:1:Error: Cannot open load file: py-bug-numbered-tests
...
> Done (Total of 9 files compiled, 1 failed in 5 directories)

Am I doing something wrong?

details:

$ lsb_release -ds
Linux Mint Debian Edition
$ uname -rv
2.6.39-2-amd64 #1 SMP Tue Jul 5 02:51:22 UTC 2011
$ which emacs
/usr/bin/emacs
$ emacs --version
GNU Emacs 23.3.1
...
$ which python
/opt/EPD/epd-7.1-2-rh5-x86_64/bin/python
$ python --version
Python 2.7.2 -- EPD 7.1-2 (64-bit)

I also have pymacs already installed, which perhaps makes this test invalid, and certainly makes it incomplete. I had python-mode=6.0.2 installed @

~/.emacs.d/site-lisp/python/python-mode

so I did

me@it:~/.emacs.d/site-lisp/python$ rm -fr python-mode
me@it:~/.emacs.d/site-lisp/python$ bzr branch lp:python-mode
> You have not informed bzr of your Launchpad ID, and you must do this to
> write to Launchpad or access private data. See "bzr help launchpad-login".
> Branched 580 revision(s).
me@it:~/.emacs.d/site-lisp/python$ cd python-mode/tools/
me@it:~/.emacs.d/site-lisp/python/python-mode/tools$ chmod a+x ./byte-compile-directory.sh
me@it:~/.emacs.d/site-lisp/python/python-mode/tools$ ./byte-compile-directory.sh
> GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4)
> of 2011-04-10 on brahms, modified by Debian
> Cannot open load file: /home/me/.emacs.d/site-lisp/python/python-mode/tools/pymacs/pymacs.el

Perhaps it should tell the user that it wants to be run like
$ tools/byte-compile-directory.sh
?

me@it:~/.emacs.d/site-lisp/python/python-mode/tools$ cd ..
me@it:~/.emacs.d/site-lisp/python/python-mode$ tools/byte-compile-directory.sh
> GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4)
> of 2011-04-10 on brahms, modified by Debian
> Checking /home/me/.emacs.d/site-lisp/python/python-mode/...
> Compiling /home/me/.emacs.d/site-lisp/python/python-mode/highlight-indentation.el...

> In highlight-indentation:
> highlight-indentation.el:70:43:Warning: reference to free variable
> `highlight-indent-offset'
> highlight-indentation.el:94:28:Warning: assignment to free variable
> `highlight-indent-offset'
> Wrote /home/me/.emacs.d/site-lisp/python/python-mode/highlight-indentation.elc
> Compiling /home/me/.emacs.d/site-lisp/python/python-mode/python-mode.el...

> In py-choose-shell-by-shebang:
> python-mode.el:1502:40:Warning: assignment to free variable `erg'
> python-mode.el:1502:72:Warning: reference to free variable `erg'

> In py-execute-file:
> python-mode.el:1865:19:Warning: `save-excursion' defeated by `set-buffer'

> In py-pdbtrack-overlay-arrow:
> python-mode.el:1899:1:Warning: reference to free variable `arrow-position'
> python-mode.el:1898:16:Warning: assignment to free variable `overlay-'
> python-mode.el:1900:42:Warning: variable assignment to constant `nil'

> In py-pdbtrack-get-source-buffer:
> python-mode.el:1998:20:Warning: `save-excursion' defeated by `set-buffer'

> In py-pdbtrack-grub-for-buffer:
> python-mode.el:2019:44:Warning: `save-excursion' defeated by `set-buffer'
> python-mode.el:2023:42:Warning: `save-excursion' defeated by `set-buffer'

> In py-postprocess-output-buffer:
> p...

Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.