mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-21 19:55:33 -04:00
vendor_detect: convert to python3 script
* Binaries are subject to os env
This commit is contained in:
parent
da01e6dcbe
commit
59ed1a0d66
3 changed files with 28 additions and 35 deletions
|
|
@ -1,29 +0,0 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
using namespace std;
|
||||
std::vector<std::string> get_directories(const std::string& s)
|
||||
{
|
||||
std::vector<std::string> r;
|
||||
for(auto& p : std::filesystem::recursive_directory_iterator(s))
|
||||
if (p.is_directory())
|
||||
r.push_back(p.path().string());
|
||||
return r;
|
||||
}
|
||||
int main(){
|
||||
std::vector<std::string> vendors = get_directories("vendor");
|
||||
for (int i = 0; i < vendors.size(); i++){
|
||||
std::string name = vendors[i].substr(7, vendors[i].length());
|
||||
name = name.substr(0, name.find('/'));
|
||||
if (name != "qcom" && name != "nxp" && name != "samsung"
|
||||
&& name != "gapps" && name != "google" &&
|
||||
name != "gms" && name != "codeaurora"){
|
||||
ofstream output;
|
||||
output.open("device/samsung/universal7885-common/vendor_name");
|
||||
output << name;
|
||||
output.close();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
25
universal7885-common/vendor_detect/main.py
Normal file
25
universal7885-common/vendor_detect/main.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import os
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-d", help="Debug", type=int)
|
||||
args = parser.parse_args()
|
||||
var = vars(args)
|
||||
DEBUG = var['d'] == 1
|
||||
blacklist = ["qcom", "nxp", "samsung", "gapps", "google", "gms", "codeaurora"]
|
||||
vendors = os.listdir("vendor")
|
||||
for vendor in vendors:
|
||||
if DEBUG:
|
||||
print("Found vendor " + vendor)
|
||||
if vendor in blacklist:
|
||||
if DEBUG:
|
||||
print("Vendor " + vendor + " in blacklist. Skipping...")
|
||||
else:
|
||||
if DEBUG:
|
||||
print("Vendor " + vendor + " not in blacklist. Writing...")
|
||||
f = open("device/samsung/universal7885-common/vendor_name", "a")
|
||||
f.write(vendor)
|
||||
f.close()
|
||||
break
|
||||
|
||||
|
||||
|
||||
|
|
@ -7,13 +7,10 @@ git clone https://github.com/lineageos/android_hardware_samsung_nfc hardware/sam
|
|||
git clone https://github.com/lineageos/android_hardware_samsung_slsi_libbt hardware/samsung_slsi/libbt
|
||||
git clone https://github.com/lineageos/android_hardware_samsung_slsi_scsc_wifibt_wifi_hal hardware/samsung_slsi/scsc_wifibt/wifi_hal
|
||||
git clone https://github.com/lineageos/android_hardware_samsung_slsi_scsc_wifibt_wpa_supplicant_lib hardware/samsung_slsi/scsc_wifibt/wpa_supplicant_lib
|
||||
if ! test -f vendor_detect; then
|
||||
clang++ device/samsung/universal7885-common/vendor_detect/main.cpp -o vendor_detect -std=c++17
|
||||
if test -f device/samsung/universal7885-common/vendor_name; then
|
||||
rm device/samsung/universal7885-common/vendor_name
|
||||
fi
|
||||
if ! test -f device/samsung/universal7885-common/vendor_name; then
|
||||
touch device/samsung/universal7885-common/vendor_name
|
||||
fi
|
||||
./vendor_detect
|
||||
python3 device/samsung/universal7885-common/vendor_detect/main.py -d 0
|
||||
echo "Generating A20 Makefiles"
|
||||
./device/samsung/a20/setup.sh
|
||||
echo "Generating A20e Makefiles"
|
||||
|
|
|
|||
Loading…
Reference in a new issue