Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using --output-dir, should not check for html files in source directory #29

Closed
dregad opened this issue Jul 6, 2021 · 9 comments
Closed
Labels

Comments

@dregad
Copy link

dregad commented Jul 6, 2021

Consider source directory with some log files and matching html files generated by running logs2html in place:

cd /tmp
mkdir source
cd source
touch test.2021-07-0{1..3}.log
logs2html .

Now run the script with a target directory:

cd /tmp
logs2html --output-dir=target source

⚠️ Problem: The target dir does not contain any html files

$ ls -1 target
index.html
irclog.css
latest.log.html

Now delete one of the html files in source and repeat

rm source/test.2021-07-03.log.html
logs2html --output-dir=target source

Notice some files have been generated

$ ls -1 target/
index.html
irclog.css
latest.log.html
test.2021-07-02.log.html
test.2021-07-03.log.html

Update a log file in source

touch source/test.2021-07-01.log.html
logs2html --output-dir=target source

Modified file is generated too

$ ls -1 target/
index.html
irclog.css
latest.log.html
test.2021-07-01.log.html
test.2021-07-02.log.html
test.2021-07-03.log.html

Expected behavior, would be to ignore any html files in source directory, and check the ones in target directory instead.

@mgedmin
Copy link
Owner

mgedmin commented Jul 7, 2021

Hmm yes, this does sound like a bug.

@mgedmin mgedmin added the bug label Jul 7, 2021
@mgedmin
Copy link
Owner

mgedmin commented Jul 7, 2021

Ah, I missed all the existing file checks while reviewing #20.

I have a fix, and a unit test that doesn't fail when it should, so uhh this will take a little bit.

@mgedmin mgedmin closed this as completed in 83a83be Jul 7, 2021
@mgedmin
Copy link
Owner

mgedmin commented Jul 7, 2021

Can you test whether the fix in git master works for you? I'm planning to publish a new release soon, and it would be good to have verification.

@dregad
Copy link
Author

dregad commented Jul 7, 2021

Thanks for fixing it so quickly.

Can you test whether the fix in git master works for you?

Sure. I'll try to do later tonight.

@dregad
Copy link
Author

dregad commented Jul 8, 2021

I'm sorry, I tried to test from Git, but didn't manage to build the script following instructions in HACKING.rst. When I run make, I get

python/bin/pip install -U setuptools
Requirement already up-to-date: setuptools in ./python/lib/python3.8/site-packages (57.1.0)
python/bin/python bootstrap.py
ez_setup.py is deprecated and when using it setuptools will be pinned to 33.1.1 since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools
Downloading https://pypi.io/packages/source/s/setuptools/setuptools-33.1.1.zip
Extracting in /tmp/tmpud6k2sp1
Now working in /tmp/tmpud6k2sp1/setuptools-33.1.1
Building a Setuptools egg in /tmp/bootstrap-0rw3jcuw
warning: no files found matching '*' under directory 'setuptools/_vendor'
/tmp/bootstrap-0rw3jcuw/setuptools-33.1.1-py3.8.egg
Couldn't find index page for 'zc.buildout' (maybe misspelled?)
Couldn't find index page for 'zc.buildout' (maybe misspelled?)
No local packages or working download links found for zc.buildout
error: Could not find suitable distribution for Requirement.parse('zc.buildout')
Traceback (most recent call last):
  File "bootstrap.py", line 192, in <module>
    raise Exception(
Exception: Failed to execute command:
'/tmp/irclog2html/python/bin/python', '-c', "import sys; sys.path[0:0] = ['/tmp/bootstrap-0rw3jcuw/setuptools-33.1.1-py3.8.egg']; from setuptools.command.easy_install import main; main()", '-mZqNxd', '/tmp/bootstrap-0rw3jcuw', 'zc.buildout'
make: *** [Makefile:63: bin/buildout] Error 1

I don't know how to fix that.

@mgedmin
Copy link
Owner

mgedmin commented Jul 8, 2021

Ah, sorry about that, the zc.buildout-based development setup is rather obsolete and I should probably rip it out entirely to avoid confusion.

It should be enough to try pip install -e . the source checkout into some virtualenv (or pip install --user -e ., whatever you prefer for installing scripts with pip -- I like pipx).

Or I could just publish the new release and hope the unit test I wrote matches your problem sufficiently well.

@mgedmin
Copy link
Owner

mgedmin commented Jul 8, 2021

2.17.3 released to PyPI.

@dregad
Copy link
Author

dregad commented Jul 8, 2021

Thanks for the hint with pip -e option, I was not aware of it (I'm not much of a Python expert).

Setup worked perfectly with pip install --user -e . (once I figured out that the files were stored in ~/.local/bin :-/)

I (somewhat belatedly) confirm that your fix addresses the problem. Many thanks !

@mgedmin
Copy link
Owner

mgedmin commented Jul 12, 2021

Yeah, Python packaging is a whole thing.

(I've started using pipx myself for installable Python command-line tools, which makes it easier to install/remove/upgrade them than installing everything into one bucket with pip install --user.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants