Jump to content

[PY]Remove objects(.o/.d) generated from gmake


Recommended Posts

  • Premium
import sys
import os
from os import path


def rmObj(objNames):
    # objNames = objNames.replace(' ', '')
    db_objDir = "locatie_DB_.obj_absoluta" #Absolut location for db dir objects, should look like /usr/src/gameSource/Server/db/src/.obj"
    game_objDir = locatie_GAME_.obj_absoluta" #Absolut location for game dir objects, should look like: /usr/src/gameSource/Server/game/src/.obj"
    obj_ExtensionLst = ['.o', '.d']

    count = 0
    for objName in objNames:
        objName = objName.replace(',', '').replace(' ', '')
        for extension in obj_ExtensionLst:
            db_ObjLocation = f"{db_objDir}/{objName}{extension}"
            game_ObjLocation = f"{game_objDir}/{objName}{extension}"

            if path.exists(db_ObjLocation):
                os.remove(f"{db_ObjLocation}")
                print(f"Removed {db_ObjLocation}")
                count += 1

            if path.exists(game_ObjLocation):
                os.remove(f"{game_ObjLocation}")
                print(f"Removed {game_ObjLocation}")
                count += 1

            if count == 0:
                print(f"No files found for given input in these locations: \n{db_objDir}, \n{game_objDir}")

if __name__ == "__main__":
    rmObj(sys.argv[1:])

The script basically deletes .o/.d compiled objects from game/db

Prereq:

Python >3.4

pkg search python -> 
pkg install python_vsr_from_search_output

Exec script: python3.X fileName.py obj_1, obj_2, ...etc

  • Good 1
  • Love 1
Link to comment
Share on other sites

  • Forum Moderator
13 minutes ago, Cappuccino said:


rm *.d
rm *.o

 

🤫

rm *.d *.o

 

Edited by VegaS™
  • Scream 1
  • Lmao 2
Link to comment
Share on other sites

  • Premium
43 minutes ago, Cappuccino said:


rm *.d
rm *.o

 

The point is to remove only the file you;'ve modified and compile only that file into a new object, but you could wait to compile errthing again, smart boi... aaand if ur decently clever u can make something that does everything from pull, rm, gmake, restart

Edited by astroNOT
Link to comment
Share on other sites

Just now, astroNOT said:

The point is to remove only the file you;'ve modified and compile only that file into a new object, but you could wait to compile errthing again, smart boi

If you run gmake it will only compile files you have modified, not everything from the beginning if file dates aren’t fucked up

 

- ya smart boi 

Link to comment
Share on other sites

  • Premium
Just now, Cappuccino said:

If you run gmake it will only compile files you have modified, not everything from the beginning if file dates aren’t fucked up

 

- ya smart boi 

Considering remote developement on freebsd is limited, and you might have to hard reset from a repo, you might find it annoying at times to keep modified dates in check, anyways, this is something I find useful, my knowledge might also be limtied but it is what it is!

Link to comment
Share on other sites

  • Forum Moderator
1 hour ago, astroNOT said:

The point is to remove only the file you;'ve modified and compile only that file into a new object, but you could wait to compile errthing again, smart boi... aaand if ur decently clever u can make something that does everything from pull, rm, gmake, restart

2 minutes ago, astroNOT said:

Imma be honest, I didn;'t know if he was making fun of the situation or not

Using touch file.cpp it's updating the file timestamp, you don't have to delete .o and .d files from .obj directory, it's useless.

https://www.freebsd.org/cgi/man.cgi?query=touch

 

  • Good 2
Link to comment
Share on other sites

  • Premium
2 minutes ago, VegaS™ said:

Using touch file.cpp it's updating the file timestamp, you don't have to delete .o and .d files from .obj directory, it's useless.

https://www.freebsd.org/cgi/man.cgi?query=touch

 

It does make sense, I'll still keep the post up if every participant till now agrees, who knows maybe the comments information will provide knowledge to more people, thanks for sharing it tho!

  • Metin2 Dev 2
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.