Jump to content

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


Recommended Posts

  • VIP
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

  • Love 1
  • Good 1
Link to post
  • VIP
Posted (edited)
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 post
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 post
  • VIP
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 post
30 minutes ago, VegaS™ said:

What's about touch file.cpp command? 

They literally just ignored you, wtf...

  • Lmao 1
Link to post
  • VIP
Posted (edited)
50 minutes ago, Doose said:

They literally just ignored you, wtf...

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

Edited by astroNOT
Link to post
  • 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 1
Link to post
  • VIP
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 1
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • 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.