Наверняка вы замечали, что в Python есть удобная функция для получения переменной окружения
os.getenv(NAME)
И её "сестра" для создания или изменения переменных окружения
os.putenv(NAME, VALUE)
Но почему-то putenv() не работает как должно. Энвайромент не обновляется!
os.putenv('MYVAR', '1')
print(os.getenv('MYVAR'))
... и ничего 😴
Почему так?
На самом деле энвайромент обновляется, но это значение не добавляется в словарь os.environ.
Откройте исходник функции os.getenv(). Это просто шорткат для os.environ.get()
В то время как putenv() это built-in С-функция.
Словарь os.environ (или точней класс из MutableMapping) создаётся из энвайромента в момент инициализации. Функция putenv() самостоятельно его не изменяет.
В тоже время, когда вы создаёте или изменяете ключ в os.environ, автоматически вызывается putenv() в методе __setitem__().
То есть, технически putenv() всё делает верно, но в os.environ это не отражается. Можно проверить так:
>>> os.putenv('MYVAR', '123')
>>> os.system('python -c "import os;print(os.getenv(\'MYVAR\'))"')
123
Я объявил переменную в текущем процессе и вызвал дочерний процесс, который её унаследовал и получил в составе os.environ.
Аналогично при удалении переменной вызывается еще одна built-in функция unsetenv(), удаляющая переменную из системы.
Итого
▫️ Удобней всего явно обновлять переменные через os.environ
▫️ Есть способ неявно создать/удалить переменную через putenv/unsetenv, что не повлияет на os.environ но изменит энвайромент и передаст изменения сабпроцессам. Но так лучше не делать!
▫️os.environ это просто обертка для built-in функций putenv() и unsetenv().
#basic
#crDroid#diting
New Version 10/09/2024:
Gapped version
Download
Changelog:
Updated to version 10.8
Note:
Firmware is NOT included.
Credits:
Thanks to @TeamMEX_XDA for all his helps and providing dt
By@Mohammadnt96
#crDroid#diting
New Version 11/07/2024:
Gapped version
Download
Changelog:
crDroid v10.6
Updated to June security patch
Including MiuiCamera
Note:
Firmware is NOT included.
This is beta version.
Credits:
Thanks to @TeamMEX_XDA for all his helps and providing dt
By@Mohammadnt96
Follow@xiaomi_12tpro_updates
Join@xiaomi_12tpro_chat
#crDroid#diting
New Version 25/02/2024:
Gapped version
Download
Changelog:
crDroid v10.2
SMS fixed
Kernel Switched to HyperOS
Used HyperOS blobs
Notes:
Use latest skkk twrp (v8.6)
Credits:
Thanks to @TeamMEX_XDA for all his helps and providing dt
Discussion:
Xiaomi 12T Pro crDroid
#crDroid#diting
New Version 02/02/2024:
Gapped version
Download
Changelog:
crDroid v10.1
fod fixed for both touchscreens
miui camera included
Known Issues:
Opening photo in miui camera
Credits:
Thanks to @TeamMEX_XDA for all his helps and providing dt
Discussion:
Xiaomi 12T Pro crDroid
#crDroid#Unofficial#diting#A14
Crdroid 10.0 UNOFFICIAL | Android 14
Updated: 11-11-2023
▪️Download
▪️Support
Changelog:
• Initial A14 build with oss vendor
Notes:
Known Issues:
Auto brightness must be disabled. otherwise screen will not wake after lock
Fod on k50u does not work
Credits: Thanks to @TeamMEX_XDA for providing dt
By@Mohammadnt96
Follow@xiaomi_12tpro_updates
Join@xiaomi_12tpro_chat
CrDroid - Official | Android 14 | Nothing Phone (2)
📝 Details:
- Version: v10.6
- Status: #Official
- Device: #Pong
- Released: 30/07/24
⬇️ Download: ROM (Vanilla) | Gapps Package
📔 Instructions: Here
🎄 Device tree : Here
📝 Changelogs : Here
🆘 Support: TG | XDA
🏷 Tags: #AOSP#ROM#CrDroid#U
✍️ Note:
- Base firmware 2.6.0 is recommended
- Dirty flash possible from previous july build
- Report with logs if you found issues in the comment section below
🏆 Credits:
- Chandu Dyavanapelli for DT Base
- Hellboy for Meteoric kernel and Glyph changes
- Fabian for PA Glyph Implementation
👤 Maintainer: @Ghosutox
🔔 Updates: @NothingPhone2Updates
🐙 Chat: @NothingPhone2
CrDroid - Official | Android 14 | Nothing Phone (2)
📝 Details:
- Version: v10.2
- Status: #Official
- Device: #Pong
- Released: 08/02/24
⬇️ Download: ROM (Vanilla) | Gapps
📔 Instructions: Here
💬 Support Group: Here
🏛 XDA: Here
💰 Donate: PayPal | BuyMeACoffee
🏷 Tags: #AOSP#ROM#CrDroid#U
✨Changelogs:
- Initial official build
- Firmware removed
- Rebased on NOS 2.5.2
- Added Reverse Wireless Charging
- Switched to qcom telephony
- Added Glyphify (An alternative app to ParanoidGlyph I made, more to come in future updates)
⛔️ Known Issues:
- Issue with reception of SMS
Enabling and disabling SIM card from settings fix the issue until the next boot
✍️ Note:
- Base firmware 2.5.2 is recommended
- Report with logs if you found issues in the comment section below
🏆 Credits:
- Chandu_Dyavanapelli for DT bring up
- Hellboy017 for kernel
- Przekichane for DT & vendor fixes on A13 » A14
- Pong TG Dev & Testing Team
👤 Dev: @DylanAkp
🔔 Updates: @NothingPhone2Updates
🐙 Chat: @NothingPhone2
CrDroid - Unofficial | Android 14 | Nothing Phone (2)
📝 Details:
- Version : v10.x
- Status: #Unofficial
- Device : #Pong
- Released : 04/01/24
⬇️ Download : ROM (Vanilla) | Gapps
📔 Instructions: Here
📸 Screenshots : Here
💬 Support Group : Here
🏛 XDA : Here
💰 Donate : PayPal | BuyMeACoffee
🏷Tags : #AOSP#ROM#CrDroid#U
✨Changelogs:
- Rebased on NothingOS 2.5.1
- Fixed stutters
- Fixed Face Unlock
- More CrDroid settings implemented
- Updated to Android QPR1 (Security patch December 2023)
✍️ Note:
- Base firmware 2.5.1 is recommended
- Report with logs if you found issues in the comment section below
🏆 Credits:
- Chandu_Dyavanapelli for DT Bringup
- Hellboy017 for kernel
- Przekichane for DT and Vendor fixes on A13 » A14
- Pong TG Dev and Testing Team for all help
👤 Dev : @DylanAkp
🔔 Updates : @NothingPhone2Updates
🐙 Chat : @NothingPhone2
CrDroid - Unofficial | Android 14 | Nothing Phone (2)
📝 Details:
- Version : v10.x
- Status: #Unofficial
- Device : #Pong
- Released : 18/12/23
⬇️ Download : Rom (Vanilla) | Gapps
📔 Instructions: Here
📸 Screenshots : Here
🏛 XDA : Here
💰 Donate : PayPal
🏷Tags : #AOSP#ROM#CrDroid#U
✨Changelogs:
- Intitial A14 build based
✍️ Note:
- Please be on NOS 2.0.4 before flashing. (Not yet tested from 2.5.1)
- Report with logs if you found issues in the comment section below
🏆 Credits:
- Chandu_Dyavanapelli for DT Bringup
- Hellboy017 for kernel
- Przekichane for DT and Vendor fixes on A13 » A14
- Snuvig for early tests
- Pong TG Dev and Testing Team for all help
👤 Dev : @DylanAkp
🔔 Updates : @NothingPhone2Updates
🐙 Chat : @NothingPhone2