How to disable phonon? - pyside

How do you disable phonon in PySide?
I am trying to use QWebpage and I don't want phonon to kick in, as the app I'm writing is a server side app, and has no need for media. I tried a few things but did not find any really relevant documentation.

A. If you use Debian/Ubuntu, remove those modules that you don't want
sudo apt-get remove python-pyside.phonon
http://packages.ubuntu.com/search?mode=exactfilename&suite=oneiric&section=all&arch=any&searchon=names&keywords=pyside
http://www.pyside.org/docs/pyside/contents.html
B.If you use setup.py package your app, you could add a excludes option
something looks like this
py2app_options = {
....
"excludes" : ["PySide.phonon"],
....
}
http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html#option-reference

Related

Yocto SYSTEMD_SERVICE to install a parameterized service ("#.service")

I need to configure WireGuard to bring up a VPN on boot on an Embedded Linux device.
My recipe installs a /etc/wireguard/wg0.conf pretty much like the examples found through the Internet.
Then I try to enable the service on SystemD like this on my wireguard.bb:
SYSTEMD_SERVICE = "wg-quick#wg0.service"
SYSTEMD_AUTO_ENABLE = "enable"
But bitbake throws me an error:
ERROR: Function failed: SYSTEMD_SERVICE_my-conf value wg-quick#wg0.service does not exist
I checked the temporary directory and file wg0.conf appears in the correct places but it seems that bitbake's SYSTEMD_SERVICE doesn't know how to expand the "wg0" after # sign.
If I try without the interface name (wg0):
SYSTEMD_SERVICE = "wg-quick#.service"
Bitbake is happy and finalizes my recipe, but it is not what systemd is expecting. Starting a service without an interface makes no sense...
Then I tried another approach and split the "wireguard" package itself from the configuration ("wireguard-conf" package) and added DEPENDS and RDEPENDS on "wireguard".
This got even worse since my wireguard-conf.bb recipe does not contain a "wg-quick#.service" file (it comes from the dependency "wireguard").
Well,
I don't know how to properly fix it and any suggestions will be highly appreciated.
Additional Info
I am using Yocto 2.0.3 in this project (with no hope of updating it).
Thanks to #TomasNovotny comments I managed to compare my "systemd.bbclas" against Github and noticed a change in systemd_populate_packages() that seems to solve the problem.
It works in newer OpenEmbedded (looks like in krogoth, version 2.1 released Apr 2016) and it is introduced by this commit. It works for me in rocko (version 2.4 released Oct 2017). According to j4x's comment, it doesn't work in jethro (version 2.0, Nov 2015).
For older (and currently unsupported OpenEmbeddeds) you can try to backport the patch or handle the symlinks for enabling the service in do_install().
Also please note that SYSTEMD_SERVICE_${PN} variable is package specific, so the _${PN} suffix has to be added (see manual).
I've also tried to enable OpenVPN with my profile (in Yocto rocko) without success.
Finally, I've made it working by providing OpenVPN recipe extension instead of custom one. So, the openvpn_%.bbappend file looks like:
inherit systemd
SYSTEMD_SERVICE_${PN} = "openvpn#clientprofile.service"
SYSTEMD_AUTO_ENABLE = "enable"
do_install_append() {
install -d ${D}${sysconfdir}/openvpn/
ln -sf /data/etc/openvpn/clientprofile.conf ${D}${sysconfdir}/openvpn/clientprofile.conf
}
As you can see, I'm using a symlink to my profile instead of the normal file. You can install a normal OpenVPN profile file instead of making symlink and it also works fine.

Can't figure out how to use pug-php/pug

I've installed https://github.com/pug-php/pug using composer and now I have a subdirectory vendor/pug-php/pug in my project but I can't figure out how to use it.
If I try
$pug = new Pug();
I obviously got
Class 'Pug' not found
How can I use it?
If you installed pug with composer you should find an autoloader.php in your vendor folder.
This made it work:
use Pug\Pug;
include('vendor/autoload.php');
Take a look at the examples in pug:
https://github.com/pug-php/pug/blob/master/example/index.php
This shows how you use it standalone.
The autoloader, which is missing in your question, you can find here:
https://github.com/pug-php/pug/blob/master/example/bootstrap.php

Add angular-material to mean.io app

I'm trying to add angular-material to a mean.io application.
I have, in my custom package, used bower to install angular-material and now I have a .../public/assets/lib/angular-material folder.
So far so good. Now I want to use it in my custom mean.io module and according to their documentation I have added
MyPackage.angularDependencies(['ngMaterial']);
in my app.js file.
I have also aggregated angular-material.css and angular-material.js (not sure if this should be needed).
But, I get the following error:
Failed to instantiate module mean due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.4.8/$injector/modulerr?p0=m...)
at Error (native)
at http://127.0.0.1:3001/bower_components/angular/angular.min.js?v=90fb950dbc3e9296755d9cc23a211744:6:416
at http://127.0.0.1:3001/bower_components/angular/angular.min.js?v=90fb950dbc3e9296755d9cc23a211744:38:391
at n (http://127.0.0.1:3001/bower_components/angular/angular.min.js?v=90fb950dbc3e9296755d9cc23a211744:7:333)
at g (http://127.0.0.1:3001/bower_components/angular/angular.min.js?v=90fb950dbc3e9296755d9cc23a211744:37:488)
at http://127.0.0.1:3001/bower_components/angular/angular.min.js?v=90fb950dbc3e9296755d9cc23a211744:38:134
at n (http://127.0.0.1:3001/bower_components/angular/angular.min.js?v=90fb950dbc3e9296755d9cc23a211744:7:333)
at g (http://127.0.0.1:3001/bower_components/angular/angular.min.js?v=90fb950dbc3e9296755d9cc23a211744:37:488)
at eb (http://127.0.0.1:3001/bower_components/angular/angular.min.js?v=90fb950dbc3e9296755d9cc23a211744:41:249)
at c (http://127.0.0.1:3001/bower_components/angular/angular.min.js?v=90fb950dbc3e9296755d9cc23a211744:19:463
I'm assuming mean doesn't find the angular-material module and I need to specify its path somewhere. But I can't figure out where.
I had the same problem, this is happening because angular couldn't resolve some required libraries by material, I didn't get so deep into this investigation but I found an alternative solution as described below:
Navigate to the project root directory and then install angular material using bower:
$ bower install angular-material --save
Then, into the project root directory you will find the /config/assets.json file where AngularJS is included, now you add the angular material libraries like this:
{
"core": {
"css": {
"bower_components/build/css/dist.min.css": [
"bower_components/angular/angular-csp.css",
-> "bower_components/angular-material/angular-material.css",
"bower_components/angular-ui-select/dist/select.min.css"
]
},
"js": {
"bower_components/build/js/dist.min.js": [
"bower_components/jquery/dist/jquery.min.js",
"bower_components/angular/angular.min.js",
-> "bower_components/angular-aria/angular-aria.js",
-> "bower_components/angular-animate/angular-animate.js",
-> "bower_components/angular-material/angular-material.js",
"bower_components/angular-mocks/angular-mocks.js",
"bower_components/angular-cookies/angular-cookies.min.js",
"bower_components/angular-resource/angular-resource.min.js",
"bower_components/angular-sanitize/angular-sanitize.min.js",
"bower_components/angular-ui-router/release/angular-ui-router.min.js",
"bower_components/angular-jwt/dist/angular-jwt.min.js",
"bower_components/angular-bootstrap/ui-bootstrap-tpls.js",
"bower_components/angular-ui-select/dist/select.min.js",
"bower_components/web-bootstrap/index.js"
]
}
}
}
I know mean.io says to not alter the core packages, but I didin't find another way to make it work, if anybody has a better solution, please tell us.

Composer [UnexpectedValueException] error will trying to use composer to install a github project

I am trying to install a github project using composer and get the following error
Composer [UnexpectedValueException]
Your Github oauth token for github.com contains invalid characters: ""
Can anyone explain what I need to do to correct this error?
I am using the following command
composer create-project --prefer-dist --stability=dev vova07/yii2-start yii2-start
Thank you
I started getting a similar error and the reason was that Github recently changed the format of their auth tokens:
https://github.blog/changelog/2021-03-31-authentication-token-format-updates-are-generally-available/
To resolve the error:
Find the composer/auth.json file (if you're running the project in a container, you'll have to bash into it and find the file in there)
Remove its github.com entry. Your file will probably look like the following after removing the entry: {"github-oauth": {}}
Run composer self-update. The issue got resolved in version 2.0.12. See the first item in the changelog for that version here: https://getcomposer.org/changelog/2.0.12
After that, you can restore your composer/auth.json file to its initial state as the newer version of composer will recognize the new key format.
You can try Basic Auth instead:
Change this (oauth):
"github-oauth": {
"github.com": "ghp_[YOUR-PERSONAL-TOKEN]"
}
To this (basic auth):
"http-basic": {
"github.com": {
"username": "[YOUR-GITHUB-USERNAME]",
"password": "ghp_[YOUR-PERSONAL-TOKEN]"
}
}
You can find instructions on how to create a Personal Access Token
Inspired from github docs. Apparently, you can use Basic Authentication with a Personal Access token instead of oauth in some cases (e.g. like mine: installing a private git repo with composer).
I fixed it.
Goto C:\Users\XXXXX\AppData\Roaming\Composer
Open the auth.json
delete the github.com entry under "github-oauth": {}
That's it.
Update answer for Masiorama and Ruchir Mehta:
If you looking for file auth.json but don't know how, use this command:
locate auth.json
And here's the result:
You can see that auth.json will look like this:
/home/{your user name}/.config/composer/auth.json
Then you could use this command to edit the file:
sudo gedit /home/dev/.config/composer/auth.json
And remove content inside github-oauth.
If you're on MacOS, the auth.json file is at ~/.composer/auth.json. Then from there, you can remove the value for github-oauth. I tried fully deleting the file but I got a parse error, Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['. Your auth.json file should look like this:
{
"github-oauth": {}
}
This is similar to other answers posted but I wasn't able to use the locate command on MacOS so this might be helpful to other Mac users
This error recently popped up from nowhere.
Simply deleting the whole auth file worked for me..! Not sure why / when it appeared in the first place.
~/.composer/auth.json
As far as I know (I'm a beginner with composer too), the problem is with your authentication, so you have to fix your credentials in auth.json inside path-to-composer/.composer/
Inside you will find a json which will probably looks like:
{
"github-oauth": {
"github.com": null
}
}
Fix that and you should be ok ;)
The solution is just to upgrade your Composer version
using command composer self-update.
Go to C:\Users\UserName\AppData\Roaming\Composer
Open the auth.json file.
Clear everything and paste the below code
{
"bitbucket-oauth": {},
"github-oauth": {},
"gitlab-oauth": {},
"gitlab-token": {},
"http-basic": {},
"bearer": {}
}
I hope it will be solved
I run in the same problem after upgrading githup api token to the new format.
The answer is you need to upgrade composer version 1.10.21 or higher that fixes this problem.
Same solution as the answer of Paulina Khew but with command lines on MacOS :
cd ~/.composer/
nano auth.json
Delete what is inside th bracket :
{
"github-oauth": {}
}
When you're ready to save the file, hold down the Ctrl key and press the letter O
Press the Enter key on your keyboard to save.
When finished, press Ctrl + X to close nano and return to your shell.
Edit the composer authentication configuration file ~/.composer/auth.json
Then replace the following.
"http-basic": {
"github.com": {
"username": "[YOUR-GITHUB-USERNAME]",
"password": "ghp_[YOUR-PERSONAL-TOKEN]"
}
}
Now run the command composer install
That's a bug.
If you have Debian or Ubuntu, try this patch. Otherwise read the last line.
Quick copy-paste patch
If you have Debian 10 buster or Ubuntu 20.LTS or similar distributions, try this copy-paste command:
wget https://gist.githubusercontent.com/valerio-bozzolan/84364c28a3bba13751c504214016adcf/raw/c1356d529c89c10de4c959058e2e86ffe58fa407/fix-composer.patch -O /tmp/fix-composer.patch
sudo patch /usr/share/php/Composer/IO/BaseIO.php /tmp/fix-composer.patch
If it does not work, write it in the comments.
Step-by-step explaination
Your Composer version has a bug: you are able to save a valid GitHub token, but then it's not able to read that token again because Composer thinks that your GitHub token cannot contain underscores or stuff like that. Moreover, it's strange that Composer checks its syntax only the second time. Why? that's another story.
The fix is simple. You can temporary disable that wrong validation in your Composer version. Also because GitHub is a proprietary service and their specifications can change over time (as you demonstrated today). So it makes sense not to validate the syntax of GitHub tokens. The only person who should hard-validate GitHub tokens is GitHub itself, not Composer.
If you installed Composer via apt install composer, probably you will not have any update available and surely you cannot use self-update because Composer is read-only for security reasons (and for a similar reason, you should not execute Composer from root). Instead, you can create a safe hot-patch to fix that specific issue.
To create a patch, create a file called /tmp/fix-composer.patch with this exact content:
103,105c103,105
< if (!preg_match('{^[.a-z0-9]+$}', $token)) {
< throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
< }
---
> // if (!preg_match('{^[.a-z0-9]+$}', $token)) {
> // throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
> //
That content can also be seen from here:
https://gist.github.com/valerio-bozzolan/84364c28a3bba13751c504214016adcf
Then run this command to apply that patch:
sudo patch /usr/share/php/Composer/IO/BaseIO.php /tmp/fix-composer.patch
If it does not work, probably you have not installed composer via apt.
In short, whatever operating system, and whatever installation method, locate the file BaseIO.php in your Composer and comment out the validation check.

websockets.os is missing from kamailio source

i can not include websockets module in kamailio there no websockets.os in kamailio source in/usr/local/src/kamailio-4.0/kamailio/modules/websockets/or
/usr/local/src/kamailio-4.0/kamailio/modules_k/websockets/
i try to install kamailio-4.0 from git i follow this link
http://www.kamailio.org/wiki/install/4.0.x/gitenter link description here
Be sure you added websocket module to be compiled. It depends on libunistring and because of that it is not compiled by default.
To compile it, do:
make include_modules="websocket" cfg
make all
make install
If you need other extra module, add it to include_modules value. For example, to compile db_mysql and websocket, use:
make include_modules="db_mysql websocket" cfg
The alternative is to edit the file modules.lst and add the extra modules to "include_modules" variable. If you don't have the file modules.lst, do:
make cfg
After editing the file, do the usual "make all; make install".

Resources