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

Files-from parameter doesn't find files #85

Open
raspi opened this issue Feb 21, 2017 · 4 comments
Open

Files-from parameter doesn't find files #85

raspi opened this issue Feb 21, 2017 · 4 comments

Comments

@raspi
Copy link

raspi commented Feb 21, 2017

If you use --files-from parameter pot-create doesn't find file(s).

 $VENV/bin/pot-create --config "lang.conf" --files-from locale-files.txt --output /dev/null
 Can not find file /home/raspi/projects/test/foo/__init__.py
$ stat /home/raspi/projects/test/foo/__init__.py
  File: '/home/raspi/projects/test/foo/__init__.py'
  Size: 2071      	Blocks: 8          IO Block: 4096   tavallinen tiedosto
Device: 801h/2049d	Inode: 4069600     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/   raspi)   Gid: ( 1000/   raspi)
Access: 2017-02-21 09:21:38.523260776 +0200
Modify: 2017-02-21 09:21:38.523260776 +0200
Change: 2017-02-21 09:21:38.523260776 +0200
 Birth: -

locale-files.txt:

/home/raspi/projects/test/foo/__init__.py
/home/raspi/projects/test/foo/lib/__init__.py
/home/raspi/projects/test/foo/models/__init__.py
/home/raspi/projects/test/foo/models/user.py
/home/raspi/projects/test/foo/include/layouts.py
/home/raspi/projects/test/foo/include/urli18n.py
/home/raspi/projects/test/foo/include/security.py
/home/raspi/projects/test/foo/include/__init__.py
/home/raspi/projects/test/foo/include/routes.py
/home/raspi/projects/test/foo/database/__init__.py
/home/raspi/projects/test/foo/database/loginlog.py
/home/raspi/projects/test/foo/database/user.py
/home/raspi/projects/test/foo/views/dberrors.py
/home/raspi/projects/test/foo/views/errors.py
/home/raspi/projects/test/foo/views/__init__.py
/home/raspi/projects/test/foo/views/views.py
/home/raspi/projects/test/foo/views/templates/form_login.pt
/home/raspi/projects/test/foo/views/templates/500.pt
/home/raspi/projects/test/foo/views/templates/languages.pt
/home/raspi/projects/test/foo/views/templates/footer.pt
/home/raspi/projects/test/foo/views/templates/home.pt
/home/raspi/projects/test/foo/views/templates/default_layout.pt
/home/raspi/projects/test/foo/views/templates/form_logout.pt
/home/raspi/projects/test/foo/views/templates/main_menu.pt
/home/raspi/projects/test/foo/views/templates/403.pt
/home/raspi/projects/test/foo/views/templates/logout.pt
/home/raspi/projects/test/foo/views/templates/error_database.pt
/home/raspi/projects/test/foo/views/templates/404.pt
/home/raspi/projects/test/foo/views/templates/login.pt
@wichert
Copy link
Owner

wichert commented Feb 21, 2017

That looks like a bug.

Looking at this and your other ticket I'm wondering what your are trying to do. Can you explain what the problem is you're trying to solve?

@raspi
Copy link
Author

raspi commented Feb 21, 2017

I'm trying to write shell script which updates main default.pot and after that all other locales of Pyramid application.

#!/bin/bash -e
export APP=$1
export HERE="$(dirname $(readlink -f "$0"))"
export PYTHONDONTWRITEBYTECODE=1
export VENV="$HERE"

python3 -m venv $VENV

./rm_python_cache.sh

LOCALEFILES="$HERE/locale-files.txt"

echo "Generating file list.."
find "$HERE/$APP" -type f -iname "*.py" > "$LOCALEFILES"
find "$HERE/$APP" -type f -iname "*.pt" >> "$LOCALEFILES"

LOCALEDIR="$HERE/$APP/locale"
mkdir -p "$LOCALEDIR"
LOCALEPOT="$LOCALEDIR/default.pot"

strace -e trace=open $VENV/bin/pot-create --config "lang.conf" --files-from $LOCALEFILES --output "$LOCALEPOT"
#$VENV/bin/pot-create --config "lang.conf" --directory $APP/* --output "$LOCALEPOT"
echo ""

cd "$LOCALEDIR"

echo "Updating .po files.."
find . -type f -iname "*.po" -exec bash -c "echo 'file: {}'; msgmerge --update '{}' '$LOCALEPOT'" \;
echo ""

echo "Generating .mo files.."
find . -type f -iname "*.po" -print0 | while read -d '' -r file; do 
  MOFILE="${file%.*}.mo"
  echo "${file} -> $MOFILE"
  msgfmt "${file}" -o "$MOFILE" 
done
echo ""

echo "Listing files:"
find . -type f 
echo ""

cd -

echo "Done."

@wichert
Copy link
Owner

wichert commented Feb 21, 2017

@raspi
Copy link
Author

raspi commented Feb 21, 2017

I wasn't aware of that script. Sometimes I also need to add files to translatable filelist with certain rules and exclude or include some files. So that script is just very stripped down version.

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

No branches or pull requests

2 participants